Locator naming differences
Last modified on Fri 20 Sep 2024

Naming differences

There are some naming differences that add to the confusion when comparing Appium, Android, and iOS terminology. Specifically, when using AppiumBy.ID and AppiumBy.ACCESSIBILITY_ID.

To help with understanding, it is useful to use Appium Inspector to visualize the differences.

Appium Inspector displays two useful sections on the right-hand side, Find By and Attribute.

inspecting_android_app

AppiumBy.ID

When locating an element using AppiumBy.ID, Appium looks for the following atributes:

AppiumBy.ACCESSIBILITY_ID

When locating an element using AppiumBy.ACCESSIBILITY_ID, Appium looks for the following attributes:

Appium Inspector

When inspecting the app with Appium Inspector you see the available strategies shown in the Find By section, and element attributes in the Attribute section.

Find By

For Android

For iOS

Attribute

For Android

For iOS

Table: Locator strategies in Appium Inspector

The table below shows different locator strategies used in Appium, and corresponding attributes shown in Appium Inspector.

Appium Inspector Android iOS
id resource-id name
accessibility id content-desc name

Table: Element attributes in Appium Inspector

The table below shows different element attributes used by Appium, and corresponding properties that are set on mobile platforms.

Appium Inspector Android iOS
resource-id Resource ID
content-desc ContentDescription
name accessibilityLabel / accessibilityIdentifier
label accessibilityLabel

Note:

Additional resources

Check Mobile - element IDs for info on how to set the element ID.