Skip to content

Inspector

Inspect native Android views over a screenshot, verify and copy Appium and Selenide selectors, emulate tap/type/swipe actions and use them in native UI tests.

The Inspector tab next to DevTools captures a snapshot of the device’s screen and its native Android view hierarchy, highlights bounds directly on the screenshot, lets you verify and copy selectors for automated tests, and emulates touch, swipe, text and key actions on the live device.

The Inspector tab: screenshot with highlighted bounds, hierarchy tree, selector tester, actions and ready-to-copy Appium/Selenide snippets
  1. Toolbar — Capture takes a fresh screenshot and view hierarchy on demand; Inspect / Tap switches whether clicking the screenshot selects a view or sends a real tap to the device; Back presses Android Back; XML copies the full Appium-style hierarchy XML; Auto-refresh re-captures the snapshot automatically ~450 ms after any emulated action; on the right, the focused package/Activity pill (click to copy) and view count.
  2. Selector tester — pick a strategy (id, accessibility id, xpath, class name, UiAutomator, text), enter a selector and see immediately how many views match in the current snapshot. Every matching view is outlined in dashed amber on the screenshot and highlighted in the tree; use < / > to step through matches or Selenide to copy the snippet.
  3. Snapshot pane — renders the captured PNG with pixel-accurate overlays: blue for the selected view, light blue on hover and dashed amber for selector-tester matches. Clicking picks the smallest deepest view under the pointer.
  4. Hierarchy tree — collapsible view tree showing the short class name, #id, "text" and [content-desc]. Selecting a view on the screenshot expands its ancestors in the tree automatically.
  5. Details pane:
    • Actions — Tap, Long press, Swipe up / down, Enter and Type (taps the selected view to focus it, then pastes the text) run directly on the device through POST /v1/device/input.
    • Selectors — suggested id, accessibility id, UiAutomator and shortest unique xpath with a unique / N matches badge and one-click Test, Value, Selenide and Appium buttons.
    • Attributes — flags (clickable, enabled, focused, checked, selected, scrollable, long-clickable, password) and clickable key/value rows (class, resource-id, text, content-desc, package, bounds, index).

Workflow: from Inspector to automated test

Section titled “Workflow: from Inspector to automated test”

A typical workflow for writing a native UI test takes a few minutes:

  1. Launch the APK in Holtdroid and open Inspector.
  2. On the splash or first screen, click Capture and note the focused activity pill (e.g. com.example.shop/.SplashActivity) or a loader’s resource-id.
  3. Wait for the app to settle, click Capture, select the sign-in button on the screenshot and click Test to confirm it says 1 match (unique), then copy its Selenide or Appium snippet.
  4. Click Tap in Actions (with Auto-refresh enabled) to advance to the login form. Inspect the email and password fields, test typing into them with Type, and click Tap on Sign in.
  5. Navigate to the target section (for example Orders), capture once more and copy the selectors for the tab and the content you want to assert.

Using the selectors in tests (Spring Boot + JUnit 5 + Selenide-Appium)

Section titled “Using the selectors in tests (Spring Boot + JUnit 5 + Selenide-Appium)”

Holtdroid’s /wd/hub endpoint supports target: native over appium-uiautomator2-server (WebDriver docs). Standard io.appium:java-client and com.codeborne:selenide-appium clients connect directly — no custom Holtdroid client library is needed.

<dependency>
<groupId>com.codeborne</groupId>
<artifactId>selenide-appium</artifactId>
<version>7.9.4</version>
<scope>test</scope>
</dependency>

(selenide-appium brings io.appium:java-client transitively.)

2. Spring test configuration (AndroidDriver bean / WebDriverProvider)

Section titled “2. Spring test configuration (AndroidDriver bean / WebDriverProvider)”

Configure UiAutomator2Options with holtdroid:options (setting target: "native" or letting UiAutomator2Options’s appium:automationName=UiAutomator2 pick it automatically). Holtdroid sets waitForIdleTimeout: 0 and waitForSelectorTimeout: 0 by default so animated splash screens do not stall checks.

@TestConfiguration
public class HoltdroidNativeConfig {
@Bean
public WebDriverProvider holtdroidDriverProvider(
@Value("${holtdroid.url}") String hubUrl,
@Value("${holtdroid.token}") String token,
@Value("${holtdroid.source}") String source,
@Value("${holtdroid.artifact}") String artifact) {
return capabilities -> {
var options = new UiAutomator2Options()
.setCapability("holtdroid:options", Map.of(
"target", "native",
"source", source,
"artifact", artifact,
"location", "pl",
"record", true
));
var config = ClientConfig.defaultConfig()
.baseUrl(URI.create(hubUrl).toURL())
.authenticateAs(new UsernameAndPassword("ci", token))
.readTimeout(Duration.ofMinutes(5));
return new AndroidDriver(config, options);
};
}
}

3. Auth check, login and navigating to a section

Section titled “3. Auth check, login and navigating to a section”

This example waits for the splash screen to close, checks whether an auth session is already active, signs in if needed, and opens the Orders section using the exact selectors copied from the Inspector tab:

@SpringBootTest(classes = HoltdroidNativeConfig.class)
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
class OrdersFlowTest {
@Autowired
WebDriverProvider driverProvider;
@BeforeAll
void startDevice() {
Configuration.browser = driverProvider.getClass().getName();
Configuration.timeout = 10_000;
WebDriverRunner.setWebDriver(driverProvider.createDriver(new DesiredCapabilities()));
}
@AfterAll
void stopDevice() {
Selenide.closeWebDriver(); // stops the Holtdroid device
}
@Test
void signInIfNeededAndOpenOrders() {
var driver = (AndroidDriver) WebDriverRunner.getWebDriver();
// 1. Wait until the splash screen closes (by loader element or activity name)
$(AppiumBy.id("com.example.shop:id/splash_loader"))
.should(disappear, Duration.ofSeconds(15));
new WebDriverWait(driver, Duration.ofSeconds(10))
.until(d -> !".SplashActivity".equals(driver.currentActivity()));
// 2. Check whether the user is already signed in
var openLoginBtn = $(AppiumBy.id("com.example.shop:id/open_login"));
var emailField = $(AppiumBy.id("com.example.shop:id/email"));
if (openLoginBtn.is(visible) || emailField.is(visible)) {
if (openLoginBtn.is(visible)) {
openLoginBtn.click();
}
// 3. Sign in on the login screen
emailField.shouldBe(visible).setValue("qa@example.com");
$(AppiumBy.id("com.example.shop:id/password")).setValue("s3cr3t");
$(AppiumBy.id("com.example.shop:id/sign_in")).click();
}
// 4. Verify the authenticated home screen and open the Orders section
$(AppiumBy.id("com.example.shop:id/home_feed")).shouldBe(visible);
$(AppiumBy.accessibilityId("Orders")).click();
$(AppiumBy.id("com.example.shop:id/orders_list")).shouldBe(visible);
}
}
Section titled “4. Jumping straight to a screen via deep link and resetting between tests”
  • Open a section by deep link: call driver.get("shop://orders") or driver.executeScript("mobile: deepLink", Map.of("url", "shop://orders")) (or pass "url": "shop://orders" in holtdroid:options at launch).
  • Reset app data between tests without a new device: call POST /wd/hub/session/{sessionId}/holtdroid/app/clear-data — the agent clears app storage, restarts the app, keeps uiautomator2-server running and resets its accessibility cache under the same session id.
  • Pin test markers on the recording: call POST /wd/hub/session/{sessionId}/holtdroid/markers (start, pass, fail) as shown in the WebDriver guide.

The Inspector tab uses three Agent API endpoints (also reachable externally under /s/{provider}/{id}/… with an api-scoped access token):

Endpoint Purpose
GET /v1/device/screenshot Current screen as image/png
GET /v1/device/ui Focused package, activity, display rotation and depth-first view list (resourceId, text, description, flags and x/y/w/h)
POST /v1/device/input Emulate {"kind": "tap"|"long-press"|"swipe"|"text"|"key", …} on the device