When executing an automated test case, the object to be selected ("tapped") is different in iOS 7.x vs iOS 8.x, even though the developer didn't change code specifically for the different iOS versions. Instead of executing the step in a try catch
block, I'd rather query the simulator for iOS version and execute the correct step.
For iOS 8, the step looks like this:
UIATarget.localTarget().frontMostApp().mainWindow().collectionViews()[0].cells()[1].segmentedControls()[0].buttons()["Expanded"].tap();
and for iOS 7, the step looks like this:
UIATarget.localTarget().frontMostApp().mainWindow().collectionViews()[0].cells()[1].buttons()["Expanded"].tap();
Basically, segmentedControls
was added.
Is there a way to check the iOS version of the simulator at run time of the automation script?
The things available to you to make this determination would be:
Using #1 is probably easier.