For AI agents and LLMs: a machine-readable index is available at llms.txt. A plain-Markdown version of any documentation page is available by appending .md to its URL.
Skip to main content

Appium TestNG

Use this guide when Appium drives Android or iOS tests and TestNG is your runner. Accessibility still depends on session capabilities plus lambda-accessibility-scan at stable UI states.

Prerequisites​

  • Appium Java client (or matching stack) + TestNG
  • App build reachable by the grid
  • Accessibility entitlement

Onboarding path​

1. Configure capabilities in @BeforeClass / @BeforeMethod​

Illustrative Java pattern (adapt platform names, device, and app paths to your suite):

UiAutomator2Options options = new UiAutomator2Options();
options.setDeviceName("Pixel.*");
options.setApp("lt://APP_ID"); // or storage URL per your setup
options.setCapability("accessibility", true);
// options.setCapability("accessibility.autoscan", true); // optional
AppiumDriver driver = new AndroidDriver(new URL("https://mobile-hub.lambdatest.com/wd/hub"), options);

Use the official capability set your account documentation lists for the current Appium version. The critical addition is "accessibility": true.

note

To scan every screen your test reaches without a hook call at each one, set accessibility.autoScan to true on the session. See AutoScan for Mobile App Accessibility. Keep the hook where you need a scan at an exact moment.

2. Call the scan hook after navigation​

((JavascriptExecutor) driver).executeScript("lambda-accessibility-scan");

Place this after explicit waits for loading spinners, animations, or lazy content.

3. Run TestNG​

mvn test

4. Review reports​

Open Navigating the Dashboard and locate the session’s accessibility results.

Troubleshooting​

SymptomWhat to check
Hook throwsDriver must be a session where accessibility capability was set; verify spelling lambda-accessibility-scan.
Empty reportHook never called, or the screen never reached a stable state. To cover every screen without per-screen hooks, enable AutoScan.

Terminal First Testing With Kane CLI

Natural language browser & mobile app tests right from terminal.

×
Schedule Your Personal Demo
Kane CLI terminal

Help and Support

Related Articles