Reputation: 1
I am working on mobile automation(iOS and Android). Some of the UI elements are not having the Accessibility IDs. So, I am using xpath and the xpath is different for iOS and android. I want to include xpath for both ios and android elements in one common page object file. Now my query is: When I run the script on android device, it should pick android element's xpath and when I run the script on iOS it should pick ios element's xpath. Could anyone please help how to differentiate/configure the same.
I need how to configure the same.
Upvotes: 0
Views: 411
Reputation: 157
If you can, go through the effort of adding the accessibility Id's to the elements. Using xpath will be brittle and harder to maintain.
Upvotes: 0
Reputation: 86
From my understanding, with webdriver-io there is no alternative besides using ugly if-else statements or better, by implementing a factory design pattern.
Upvotes: 0