Select Page
I’m really liking Appium for mobile testing.  There are numerous articles on how to set it up and some good documentation on running Appium against iOS devices.  This blog post will not be about Appium for iOS.  Rather, it’s about two questions regarding Appium for Android:

  1. What is the mapping between the WebDriver find.By method and an actual android UI element?
  2. How can I get the Appium Window inspector to work on an Android emulator
The glass is half full here is I’ve only been able discern item #1.
Mapping: 

WebDriver find element by name corresponds to the android ui element’s contentDescription value

Example:
Web Driver: find by name
driver.findElement(By.name
Android: contentDescription
Finding by id will not work.  That’s unfortunate.  Finding by tag though does work.  I believe that webdriver tag corresponds to a lowercase object name of the UI element.  For example, a tag value of “button” would correspond to an android ui element <button>

WebDriver Find By Android UI Element example find by example ui element
tag lowercase android ui element type tag = “button” <Button>
name contentDescription attribute name = “loginButton” <contentDescription>loginButton