Find Element for Android/iOS Best Practice

Hi,

I’m new to Appium, and I’m an Android/iOS developer. We contract some QA Testers to develop all the UI Tests using Robot framework + Appium. But they duplicate all the code for Android and iOS and they told to me that it’s impossible to use the same code. I can’t believe that.

I know that in Java we can use annotations to find elements in both Android/iOS.
With Robot I have this line:

Wait Until Element Is Visible ${LoginScreen.btnYes} 30

And I have this resource:

&{LoginScreen}
… btnYes=br.com.mypackage:id/btnYes

But my QA testers are duplicating all the code for iOS. I can’t believe that… How can we create some testing using the same code for Android and iOS? How can I change just the id of the elements? Can anybody just show me some documentation, article, tutorial with some Best Practices?

Thank very much

What do you mean that is duplicating the code?
e.g. in robot, in order to find a button element, for example, you need to take the xpath (not recommended) or the elementId of the button. By default, Appium library includes the xptahs of the elements, but not the IDs. The IDs should be inserted into the code of the app, by developers, in order to facilitate this for testers. Depends on the language and framework used for developing the application, this might be tricky to integrate with Appium and robot. (for example, I was not able to integrate Flutter with Appium and robot)