[英]How to click "OK"on IOS alert box using Appium 1.21.0 on Simulator?
I'm writing a test using Java & Appium 1.21.0.我正在使用 Java 和 Appium 1.21.0 编写测试。 I'm unable to click "OK" button on alert box to close the popup on the Simulator iPhone.我无法单击警告框上的“确定”按钮来关闭模拟器 iPhone 上的弹出窗口。
I tried the following code:我尝试了以下代码:
Actions action = new Actions(getDriver());
action.moveToElement(getDriver().findElement(By.xpath("//XCUIElementTypeButton[@name=\"OK\"]")));
action.click();
action.perform();
The above code is not working.上面的代码不起作用。
Using the following:使用以下内容:
You can try this one:你可以试试这个:
caps.setCapability("autoAcceptAlerts", "true"); caps.setCapability("autoAcceptAlerts", "true"); //to accept all alerts //OR caps.setCapability("autoDissmissAlerts", "true"); //接受所有警报 //或 caps.setCapability("autoDissmissAlerts", "true"); //to dismiss all alerts //关闭所有警报
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.