TestProject Forum
Powered by leading experts in the test automation community

Differentiate iOS version in tests

I’m building and running tests in both iOS 12 and iOS 13, there are some differences (in location permission popup for example), so I need to add a conditional to differentiate iOS version. How can I detect the iOS version to add this conditional? Thanks in advance.

Hi @carolinadelatorrem , thanks for reaching out.

One of the ways to make the locator generic is to use it as in following example with XPath :
(//XCUIElementTypeButton[@id=‘iOS12PermissionButton’] | //XCUIElementTypeButton[@id=‘iOS13PermissionButton’])[1]
//XCUIElementTypeButton[@id=‘iOS12PermissionButton’ or @id=’ iOS13PermissionButton’]

Let me know please, if this answers your question