What kind of identifiers we can use in iOS and how to set them in APP?

Hi All,

We are using Appium to automate a consumer mobile app in iOS as well as Android. In Android, we have got “resource id” for almost all the elements and we are able to automate it successfully. For iOS we have got “xpath” for all the elements and at some places we are facing issues with that.

My question is, for iOS, can we only have Xpath or can we have some other better identifier like “resource id” too. In order for us to see other identifiers for iOS what property has to be set by the developers in the APP.

Thanks in advance.

Jerald

1 Like

That completely depends on how app is build. If elements don’t have any identifiers at all, ask developers to add IDs or class names, whatever.

Thanks kirill, we have asked them to implement accessibility IDs to the elements.

Jerald

Cool!
You are welcome!

Hi kirill,

I am also using appium for ios and we are unable to see id resource-id attributes in Hybrid WebView (Cordova) app even developement add the id’s resource-ids

For name attribute value is replace with the text which is add in html anchor tags.

Please suggest what exactly the problem,is ios app restricting the id/resource-id attributes or appium??

Thanks,
Durga Prasad

Hi Prasad,
I am also tring to automate hybrid app and not able to identify the name attributes in inspector.

did you got the solution for this?

Thanks & Regards
Amrut Sabade

Hi Amrut,

Yes, for Hybrid webview app, we need to switch to webview context and give
direct xpaths, id,name which are seen in html source.

It will work.Please let me know if you need any info.

Regards,
Durga Prasad