Appium 1.5 fails to find_element_by_name

I haven’t installed 1.5 yet but have been doing ALL of my Appium development using xpath exclusively and successfully. But I’m forced to do this as my AUT doesn’t currently have accessibility IDs at this time. So visible text is my only unique identifier I can rely on. Thus xpath to the rescue.

locators["settings.security_notifications_slider_label"] = '//UIAStaticText[@name="Security Notifications"]'

The reason people jump to saying “xpath is bad, never use xpath” is when they’re composing horribly brittle xpath based on meaningless nested indexes like:

'//UIATableGroup[2]/UIATableCell[7]/UIAStaticText[4]'

Better yet xpath allows you to find elements based on specific relationships in the page source using xpath axes.

locators["cases_and_contracts.special_all_open_cases"] = \
'//UIATableGroup[@name="SPECIAL"]/following-sibling::UIATableCell[@name="All Open Cases"]'
4 Likes