Java 在使用appium测试iOS应用程序时,如何关闭模式视图控制器
您好,我正在使用Intellij/Appium为我的iOS应用程序构建自动化测试 在我的Xcode iOS应用程序中,我向用户发出如下警报:Java 在使用appium测试iOS应用程序时,如何关闭模式视图控制器,java,intellij-idea,automated-tests,appium,Java,Intellij Idea,Automated Tests,Appium,您好,我正在使用Intellij/Appium为我的iOS应用程序构建自动化测试 在我的Xcode iOS应用程序中,我向用户发出如下警报: [vc presentViewController:alertController animated:YES completion:nil]; 这只有一个OK按钮 有人能告诉我如何在java测试脚本中消除这个问题吗? 我正在使用以下代码,但它不起作用: Object alertBoxes = this.driver.findElementsByClass
[vc presentViewController:alertController animated:YES completion:nil];
这只有一个OK按钮
有人能告诉我如何在java测试脚本中消除这个问题吗?
我正在使用以下代码,但它不起作用:
Object alertBoxes = this.driver.findElementsByClassName("UIAAlertView");
if (alertBoxes instanceof ArrayList) {
WebElement alertBox = (WebElement)((ArrayList)alertBoxes).get(0);
if (alertBox.isDisplayed()) {
alertBox.click();
}
}
很明显,我对这一切都不熟悉,所以我希望我的问题是可以理解的。谢谢。回答我自己的问题,这个解决方案很有效
this.driver.switchTo().alert().accept();
我不知道为什么这是有效的,点击不起作用。
(顺便说一句,我使用的是appium 1.6)