我的工作我的第一个UI自动化脚本,我在下面的deactivateAppForDuration线遭遇了失败:的iOS UI自动化deactivateAppForDuration失败
// Verify password field is shown when app is moved to the foreground
UIALogger.logMessage("move app to background");
target.deactivateAppForDuration(10);
UIALogger.logMessage("move app to foreground");
我从仪器得到的错误是:
Script threw an uncaught JavaScript error: Cannot perform action on invalid element: UIAElementNil from target.frontMostApp().switcherScrollView().buttons()["TimeClock"]
我在测试设备上看到的应用程序已切换到背景并显示iOS应用程序切换器。我可以看到我的应用程序(TimeClock)。它从错误消息和设备屏幕中显示,UI自动化无法选择我的应用程序以转换到前台。
有其他人遇到过这个问题吗?有没有解决办法?
谢谢。
在这种情况下,'switcherScrollView()'表示设备本身的切换控件,而不是应用程序。 'switcherScrollView()。buttons()[“TimeClock”]'表示应用切换器中他的应用的图标。 – Darc 2012-03-28 22:22:14