Sobes.tech
Middle

What Appium locators do you know?

sobes.tech AI

Answer from AI

Appium uses various locators similar to Selenium, as well as platform-specific ones for mobile platforms. Main locators:

  • id — search by the element's unique identifier.
  • accessibility id — search by accessibility label (iOS) or content-desc (Android), used for accessibility.
  • class name — search by the element's class name.
  • xpath — search by XPath expression, flexible but less performant.
  • name — deprecated locator, sometimes used.
  • android uiautomator — search using UIAutomator for Android, allows complex selectors.
  • ios predicate string — search using NSPredicate for iOS.
  • ios class chain — search by class chain in iOS.

Example of using accessibility id locator:

MobileElement el = driver.findElementByAccessibilityId("login_button");

Using the correct locator is important for test stability and speed.

What Appium locators do you know? — QA / QA Automation - sobes.tech