在XCode Instruments中,有没有办法通过Javascript在运行时找到模拟器的iOS版本
在执行自动测试用例时,要选择的对象(“点击”)在iOS 7.x和iOS 8.x中是不同的,即使开发人员没有专门为不同的iOS版本更改代码。我宁愿查询模拟器的iOS版本并执行正确的步骤,而不是在在XCode Instruments中,有没有办法通过Javascript在运行时找到模拟器的iOS版本,ios,xcode,ios-simulator,instruments,ios-ui-automation,Ios,Xcode,Ios Simulator,Instruments,Ios Ui Automation,在执行自动测试用例时,要选择的对象(“点击”)在iOS 7.x和iOS 8.x中是不同的,即使开发人员没有专门为不同的iOS版本更改代码。我宁愿查询模拟器的iOS版本并执行正确的步骤,而不是在try-catch块中执行该步骤 对于iOS 8,步骤如下所示: UIATarget.localTarget().frontMostApp().mainWindow().collectionViews()[0].cells()[1].segmentedControls()[0].buttons()["Exp
try-catch
块中执行该步骤
对于iOS 8,步骤如下所示:
UIATarget.localTarget().frontMostApp().mainWindow().collectionViews()[0].cells()[1].segmentedControls()[0].buttons()["Expanded"].tap();
UIATarget.localTarget().frontMostApp().mainWindow().collectionViews()[0].cells()[1].buttons()["Expanded"].tap();
对于iOS 7,步骤如下所示:
UIATarget.localTarget().frontMostApp().mainWindow().collectionViews()[0].cells()[1].segmentedControls()[0].buttons()["Expanded"].tap();
UIATarget.localTarget().frontMostApp().mainWindow().collectionViews()[0].cells()[1].buttons()["Expanded"].tap();
基本上,添加了分段控制
有没有办法在自动化脚本运行时检查模拟器的iOS版本?您可以通过以下方式进行确定:
使用#1可能更容易。谢谢,但是如何从UIATarget获取此变量的值呢。例如,var target=UIATarget.localTarget();UIALogger.logMessage();您是否尝试过UIATarget.localTarget().systemVersion()?我认为这将返回正确的iOS版本。如果没有,请向谢里米发送雷达,就这样!