Interact with elements IOS


I’ve been googling around quite abit how I should interact with elements when building up my appium test suite for IOS.
My understanding is to use accessability ID whenever I can, I’m using accessability inspector atm and from what I can tell is accessability id = the visible name of the button I’m clicking on. But since names tend to change throughout a app lifecycle I’m wondering what are my options?

I’ve tried in the xcode project to give a button a unique label or a value but can’t figure out how to find the element using this unique labe/value.

Thanks for help

in xCode add:

// in storyboard add: 
//  - variable name  'accessibilityIdentifier'
//  - variable type 'String'
//  - variable value 'your_unique_ID'

// or in code when element not exist on storyboard e.g.
titleLabel.accessibilityIdentifier = "headerTitle"

in Appium:

// Java

@iOSFindBy(id = "myButton_ID")
private IOSElement myButton;

// or

IOSElement myButton = driver.findElement("myButton_ID"))
1 Like

For iOS and accessibility ID you can also use the new…

IOSElement myButton = driver.findElement(MobileBy.AccessibilityId("myButton_ID"))

Thanks for help guys.

Also, what inspector are you guys currently using? Im using xcodes Accessability inspector, what do you recommend?


for iOS i use only:


I user arc and recently started using latest Appium Desktop. But still rely heavily on arc itself for now.