【发布时间】:2012-12-21 07:04:23
【问题描述】:
当我在 Instruments 中运行 UIAutomation 脚本时,一切正常,但是当我从命令行运行完全相同的脚本时,出现以下错误:
Cannot perform action on invalid element: UIAElementNil from target.frontMostApp().mainWindow().tableViews()[0].cells()["ID number, Required"].textFields()[0]
这是我用来启动测试的 Instruments 命令
instruments -t /Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.bundle/Contents/Resources/Automation.tracetemplate /Users/johan/Library/Developer/Xcode/DerivedData/Brokers-etvmwznhcjprybdekgtixzzsnbrw/Build/Products/Release-iphonesimulator/MyApp -e UIASCRIPT /Users/johan/Desktop/Script.js
【问题讨论】:
-
你能发布你用来启动测试的仪器命令吗?命令行启动的环境与 Instruments GUI 应用程序使用的环境可能存在某种差异。
-
Xcode 版本是多少?在 Xcode 4.5.2 中,一个类似的命令似乎对我有用,我的构建配置设置为 Release,iPhone 6.0 模拟器作为目标。也许尝试将您的方案切换到调试构建配置,构建,然后将您的仪器命令中的“Release-iphonesimulator”替换为“Debug-iphonesimulator”?
标签: iphone command-line instruments ui-automation ios-ui-automation