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.
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
| Symptom | What to check |
|---|---|
| Hook throws | Driver must be a session where accessibility capability was set; verify spelling lambda-accessibility-scan. |
| Empty report | Hook never called and autoscan off; or page never reached stable state. |
