allwright

API ReferenceGoMobile

Mobile

Android automation over adb — no Appium, no separate driver server. Reached through the Mobile package variable, for both Android and iOS.

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) (*NativeApp, error)

Example

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

(*NativeApp).Click

MethodSince v0.0.45 – v0.0.52

Taps the matching element.

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

Example

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

(*NativeApp).Goto / Navigate

MethodSince v0.1.19

Opens a universal link or custom URL scheme in the connected Android or iOS app.

func (p *NativeApp) Goto(ctx context.Context, url string, options ...CommandOptions) error

(*NativeApp).Fill

MethodSince v0.0.45 – v0.0.52

Sets a matching field's value.

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

(*NativeApp).Focus / Press

MethodSince v0.0.57 – v0.0.58

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

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

(*NativeApp).Count

MethodSince v0.0.57 – v0.0.58

Counts matching elements.

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

(*NativeApp).TextContent / InnerText

MethodSince v0.0.57 – v0.0.58

Reads text from a matching element.

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

(*NativeApp) state reads

MethodSince v0.1.24

Reads native input values, checked/selected state, known accessibility attributes, and on-screen bounds on Android, iOS, macOS, and Windows. The same methods are available on NativeLocator; selected-option and selected-text reads remain web-only.

func (p *NativeApp) InputValue(ctx context.Context, selector string, options ...CommandOptions) (string, error)
func (p *NativeApp) IsChecked(ctx context.Context, selector string, options ...CommandOptions) (bool, error)
func (p *NativeApp) GetAttribute(ctx context.Context, selector, name string, options ...CommandOptions) (*string, error)
func (p *NativeApp) BoundingBox(ctx context.Context, selector string, options ...CommandOptions) (*BoundingBox, error)

(*NativeApp).WaitForSelector

MethodSince v0.0.57 – v0.0.58

Waits, retrying, for an element to appear.

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

(*NativeApp).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 *NativeApp) Screenshot(ctx context.Context, options ...ScreenshotOptions) ([]byte, error)

(*NativeApp).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 *NativeApp) AccessibilitySnapshot(ctx context.Context, options ...AccessibilitySnapshotOptions) (string, error)

(*NativeApp).Locator

MethodSince v0.0.45 – v0.0.52

Builds a chainable locator scoped to the app. Native apps and locators expose GetByRole, GetByText, GetByLabel, and GetByTestId with native accessibility semantics and automatic retries.

func (p *NativeApp) Locator(selector string) *NativeLocator

Mobile.IOS.Connect

MethodSince v0.1.18

Connects to an iOS Simulator or a registered physical device (by name or UDID, or the first one available) and returns a device handle. The runtime is installed and started automatically.

func (IOSSurface) Connect(ctx context.Context, options MobileIOSConnectOptions) (*IOSDevice, error)

Example

device, _ := allwright.Mobile.IOS.Connect(ctx, allwright.MobileIOSConnectOptions{Device: "iPhone 17 Pro"})

iOS device launch

MethodSince v0.1.18

Downloads or unpacks an app (local .app, .zip/.ipa, or URL), installs it on the connected Simulator or device, and launches it. app_id is optional when an app path is given. The returned app implements the shared native app and locator contract.

func (d *IOSDevice) Launch(ctx context.Context, options MobileIOSLaunchOptions) (*IOSApp, error)

Example

app, _ := device.Launch(ctx, allwright.MobileIOSLaunchOptions{AppPath: "https://allwright.dev/Flights-simulator.ipa"})