TestProject Forum

IOS Element Locator Strategies


While debugging automated tests in our custom automation framework we are currently updating our code’s locators from mostly Xpaths to ID’s so that we can have more consistency in locating the right elements.

On the IOS side I was having some trouble finding an element. I requested our IOS team to give us some custom ID’s which they happily provided. Upon the applications update, I checked if the new elements with ID’s were present on a real device in TestProject using the element locator/explorer. They were not. Using our applications in house UIViewer I could see that the element had indeed gained the requested AccessibilityIdentifier. This does not show on the element explorer. I can’t select accessibilityid with the element locator and cant find the element using other strategies. AccessibilityID was present upon creating an element with TP. Trying to find the created element on the real device again failed.

After digging a bit I find that appium provides the following locator strategies: Find Elements - Appium. The IOS side relies on appiums xcuitest driver (GitHub - appium/appium-xcuitest-driver: Appium iOS driver, backed by Apple XCUITest) which is a combination of WDA and apple’s XCTest framework.

I assume testproject uses the same libraries to access native IOS elements. Why does the resulting xml not match the application’s data? How can i properly leverage the AccessibilityID locator strategy?

If someone can nudge me in the correct direction I would be mightily appreciated.

Thanks in advance.

Anyone? :slight_smile:

Hello @maxim.rees,

It will be easier to solve this over a zoom call,
could you send an email to:

And we will set up the meeting.

@maxim.rees we have a few locators that we have set the accessibilityID’s on an they are not visible in TestProject. If you wouldn’t mind sharing what your solution is when you find it and any other nuggets of advice they would also be welcome.

Android was super easy, iOS is well… iOS.

@greigh.macmichael Hope this helps → https://developer.apple.com/library/content/documentation/UserExperience/Conceptual/iPhoneAccessibility/Making_Application_Accessible/Making_Application_Accessible.html

Thanks @maxim.rees I have forwarded this off to our developer, although we are using Swift we hope this will be helpful.