allwright

API ReferenceGoMobile

Mobile

Android automation over adb — no Appium, no separate driver server. Reached through the Mobile package variable; iOS has no runtime yet.

Mobile.Android.Connect

MethodSince v0.0.45 – v0.0.52

Connects to a device or emulator over adb (by serial, or the first one available) and returns a device handle.

func (AndroidSurface) Connect(ctx context.Context, options MobileAndroidConnectOptions) (*AndroidDevice, error)

Example

device, _ := allwright.Mobile.Android.Connect(ctx, allwright.MobileAndroidConnectOptions{Device: "emulator-5554"})

(*AndroidDevice).Launch

MethodSince v0.0.45 – v0.0.52

Installs (from a local APK path or a URL) and launches an app, resolving the package from AppID or the APK's own metadata.

func (d *AndroidDevice) Launch(ctx context.Context, options MobileAndroidLaunchOptions) (*AndroidApp, error)

Example

app, _ := device.Launch(ctx, allwright.MobileAndroidLaunchOptions{AppID: "com.example.airticket"})

(*AndroidApp).Click

MethodSince v0.0.45 – v0.0.52

Taps the matching element.

func (p *AndroidApp) Click(ctx context.Context, selector string, options ...CommandOptions) (*ClickResult, error)

Example

app.Click(ctx, "Id=com.example.airticket:id/bottom_nav_account")

(*AndroidApp).Fill

MethodSince v0.0.45 – v0.0.52

Sets a matching field's value.

func (p *AndroidApp) Fill(ctx context.Context, selector string, value string, options ...CommandOptions) (*FillResult, error)

(*AndroidApp).Focus / Press

MethodSince v0.0.57 – v0.0.58

Focuses a matching element, or sends it a key event.

func (p *AndroidApp) Focus(ctx context.Context, selector string, options ...CommandOptions) (*ElementResult, error)
func (p *AndroidApp) Press(ctx context.Context, selector string, key string, options ...PressOptions) (*PressResult, error)

(*AndroidApp).Count

MethodSince v0.0.57 – v0.0.58

Counts matching elements.

func (p *AndroidApp) Count(ctx context.Context, selector string, options ...CommandOptions) (*CountResult, error)

(*AndroidApp).TextContent / InnerText

MethodSince v0.0.57 – v0.0.58

Reads text from a matching element.

func (p *AndroidApp) TextContent(ctx context.Context, selector string, options ...CommandOptions) (*TextResult, error)

(*AndroidApp).WaitForSelector

MethodSince v0.0.57 – v0.0.58

Waits, retrying, for an element to appear.

func (p *AndroidApp) WaitForSelector(ctx context.Context, selector string, options ...WaitForSelectorOptions) (*WaitForSelectorResult, error)

(*AndroidApp).Screenshot

MethodSince v0.0.57 – v0.0.58

Captures the app UI as a PNG; a full-page capture stitches several scrolled captures into one image instead of cropping at the visible screen.

func (p *AndroidApp) Screenshot(ctx context.Context, options ...ScreenshotOptions) (*ScreenshotResult, error)

(*AndroidApp).AccessibilitySnapshot

MethodSince v0.1.4

Captures a structured accessibility snapshot of the app UI — the same versioned JSON/YAML document shape as the web surface's snapshot.

func (t *AndroidApp) AccessibilitySnapshot(ctx context.Context, options ...AccessibilitySnapshotOptions) (string, error)

(*AndroidApp).Locator

MethodSince v0.0.45 – v0.0.52

Builds a chainable locator scoped to the app. Android has no GetByRole-style semantic builders — only raw CSS/XPath/UiAutomator (text=, resourceId=, className=, clickable=true) selectors.

func (p *AndroidApp) Locator(selector string) *AndroidLocator