Documentation, tips, tricks for migrating from Selendroid to UIAutomator or UIAutomator2

Hi,
I’m about to try to migrate a Appium 1.6.5 + Java-based codeline that has been running with Selendroid for many years. Are there any documents or guidelines that demonstrate best practices for changing locator strategies (what are the proper org.openqa.selenium.By strategies? I’m also looking for tips on inspecting elements to determine proper locators (what are the preferred tools).

Thanks in advance
-jason

1 Like

Our team completed the migration to UIAutomator2 and compiled these guidelines for converting our Java Element libraries:

You can use any of these locator strategies:

  • MobileBy.id(“toolbar_title”) or By.id(“com.pandora.android:id/toolbar_title”)
  • By.xpath("//android.widget.RelativeLayout[@content-desc=‘Now Playing’]")
  • MobileBy.xpath("//android.widget.TextView[@resource-id=‘com.pandora.android:id/toolbar_title’]")
  • MobileBy.AccessibilityId(“Play”) or By.id(“play”)

These locator strategies won’t work:

  • By.name
  • By.linkText, MobileBy.linkText or By.partialLinkText
  • xpaths with @value or @id attributes

Replacement strategies:

1 Like