A Useful Guide for XPath

@bootstraponline pointed me to this useful article, for working with XPath expressions: http://blog.scrapinghub.com/2014/07/17/xpath-tips-from-the-web-scraping-trenches/


We should also be louder about telling people working with iOS to switch to ui-automation instead of XPath

1 Like

I think xpath is much better these days, though I know @bootstraponline is still pessimistic.

We all agree that AccessibilityId’s are the best way to go though. And think, it makes your app more accessible to the handicapped!!

xpath is way better than it use to be. uiselectors/predicates have less bugs and are faster although more work to write. ids remain the best selector.

I’d love an explanation about ids. :smile:

It’s on my list to document better. Here’s a brief overview:


  • contentDescription - used for uiautomator to locate elements
  • resourceId - set in xml
  • strings.xml - set via strings.xml


  • accessibility identifier/label/hint - similar to contentDescription on android
  • Localizable.strings - similar to strings.xml on android

If you have a localization workflow using a tool such as twine in addition to standardized content descriptions/accessibility identifiers then it’s easy to write cross platform tests.

1 Like

Hi Jessica, is there a way to disable using XPath when using the Appium Inspector to record steps? It seems it defaults to using the XPath instead of the name or label. This means I have to manually enter the name or label. Thanks in advance!

this should really be stressed more in the docs. just switched from xpaths and, as you say, its way faster and more reliable.