How do I assert content description for the element in mobile apps?
This example demonstrates how to check the text description for the elements.
In the solution shown below, you will see that text description is visible in HICC using the assertContentDescription command.
Content description is an attribute that is present for graphical elements in the mobile app to provide some context to them which might otherwise not be available due to their non-text nature. This is listed as ‘accessibility-id’ in Appium if
- For Android devices, the element has a ‘content-desc’ attribute.
- For iOS devices, the element has a ‘name’ attribute.
Solution:
# | Command | Target | Value |
---|---|---|---|
Store the content description text for the income image | |||
1 | assertContentDescription | id=com.eureqa.eureqaprod:id/image2 | Include the Income(s) of yourself, your spouse, and any dependents who contribute to the household. |
Tips, Tricks, Gotchas & Best Practices:
- As a best practice, you are encouraged to validate the description for the element by using verifyContentDescription and waitForContentDescription commands.