API ReferenceJavaMobile
Mobile
Android automation over adb — no Appium, no separate driver server. Reached through Allwright.mobile().android() and Allwright.mobile().ios().
AndroidSurface.connect
Connects to a device or emulator over adb (by serial, or the first one available) and returns a device handle.
public AndroidDevice connect()
public AndroidDevice connect(MobileAndroidConnectOptions options)Example
AndroidDevice device = Allwright.mobile().android().connect(new MobileAndroidConnectOptions("emulator-5554", null, false, 30_000));AndroidDevice.launch
Installs (from a local APK path or a URL) and launches an app, resolving the package from appId or the APK's own metadata.
public synchronized AndroidApp launch()
public synchronized AndroidApp launch(MobileAndroidLaunchOptions options)AndroidApp.click
Taps the matching element.
public void click(String selector)
public void click(String selector, CommandOptions options)AndroidApp.fill
Sets a matching field's value.
public void fill(String selector, String value)
public void fill(String selector, String value, CommandOptions options)Example
app.fill("xpath=//*[@text=\"Email\"]", "user@example.com");AndroidApp.focus / press
Focuses a matching element, or sends it a key event.
public void focus(String selector)
public void press(String selector, String key)AndroidApp.count
Counts matching elements.
public int count(String selector)AndroidApp.textContent / innerText
Reads text from a matching element.
public String textContent(String selector)
public String innerText(String selector)NativeApp state reads
Reads native input values, checked/selected state, known accessibility attributes, and on-screen bounds on Android, iOS, macOS, and Windows. The same methods and CommandOptions overloads are available on NativeLocator; selected-option and selected-text reads remain web-only.
public String inputValue(String selector)
public boolean isChecked(String selector)
public String getAttribute(String selector, String name)
public BoundingBox boundingBox(String selector)AndroidApp.waitForSelector
Waits, retrying, for an element to appear.
public void waitForSelector(String selector)AndroidApp.screenshot
Captures the app UI as a PNG; a full-page capture stitches several scrolled captures into one image.
public byte[] screenshot()
public byte[] screenshot(ScreenshotOptions options)AndroidApp.accessibilitySnapshot
Captures a structured accessibility snapshot of the app UI — the same versioned JSON/YAML document shape as the web surface's snapshot.
public synchronized String accessibilitySnapshot()
public synchronized String accessibilitySnapshot(AccessibilitySnapshotOptions options)AndroidApp.locator
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.
public NativeLocator locator(String selector)Allwright.mobile().ios().connect
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.
public IosDevice connect()
public IosDevice connect(MobileIosConnectOptions options)Example
IosDevice device = Allwright.mobile().ios().connect(new MobileIosConnectOptions("iPhone 17 Pro", null, false, null));iOS device launch
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 NativeApp/NativeLocator contract.
public synchronized NativeApp launch()
public synchronized NativeApp launch(MobileIosLaunchOptions options)Example
var app = device.launch(new MobileIosLaunchOptions("https://allwright.dev/Flights-simulator.ipa", null, false, null));