Accessibility Inspection
Appium Automation provides an API to interact with the accessibility inspector service directly.
You can use the Accessibility Inspector in these ways:
- SeeTest Extension
- Script Execution
Commands
- AccessibilityStart - Starts the Accessibility Inspector service on the device.
- AccessibilityMoveNext - Moves the Accessibility Inspector to the next element.
- AccessibilityMovePrevious - Moves the Accessibility Inspector to the previous element.
- AccessibilityActivate - Activates the current element highlighted by the Accessibility Inspector. This enables actions on the element.
- AccessibilityFocusedElement - Gets current element and its information highlighted by the Accessibility Inspector.
- AccessibilityStop - Stops the Accessibility Inspector service on the device.
Usage
In order to utilize Accessibility Inspector, use AccessibilityStart. Otherwise none of the other accessibility commands work.
info
For Android devices, the target package needs to be specified using accessibilityStart(targetPackage).
Once Accessibility Inspector is activated, Continuous Testing Cloud performs the Home command and the device returns to springboard.
Use AccessibilityStop to stop the service.
info
Replace <server> with the appropriate URL.
- Public Continuous Testing Cloud - https://cloud.seetest.io/wd/hub/.
- Dedicated Continuous Testing Cloud environment - Your own domain. For example: https://company.experitest.com/wd/hub/
- On-premises Continuous Testing Cloud environment - Your designated URL. For example: https://company.com/wd/hub
Basic iOS test flow
DesiredCapabilities dc = new DesiredCapabilities();
dc.setCapability(MobileCapabilityType.UDID, "<deviceid>");
driver = new IOSDriver(new URL("<server>"), dc);
SeeTestClient seetest = new SeeTestClient(driver);
try{
seetest.accessibilityStart();
seetest.launch("com.experitest.ExperiBank", true, false);
seetest.accessibilityMoveNext();
seetest.accessibilityMoveNext();
seetest.accessibilityActivate();
String str = seetest.accessibilityFocusedElement();
JSONObject jsonObject = new JSONObject(str);
assertEquals(jsonObject.getString("label").equals(<Expected value>));
}finally{
seetest.accessibilityStop();
}
Basic Android test flow
DesiredCapabilities dc = new DesiredCapabilities();
dc.setCapability(MobileCapabilityType.UDID, "<deviceid>");
driver = new AndroidDriver(new URL("<server>"), dc);
SeeTestClient seetest = new SeeTestClient(driver);
try{
seetest.accessibilityStartLaunchApp("com.experitest.ExperiBank");
seetest.launch("com.experitest.ExperiBank", true, false);
seetest.accessibilityMoveNext();
seetest.accessibilityMoveNext();
seetest.accessibilityActivate();
String str = seetest.accessibilityFocusedElement();
JSONObject jsonObject = new JSONObject(str);
assertEquals(jsonObject.getString("label").equals(<Expected value>));
}finally{
seetest.accessibilityStop();
}