[英]How to handle iOS App session timeouts using Java and Appium in Mobile Native
I am working on an app, where i get a timeout after certain period of inactivity.我正在开发一个应用程序,在一段时间不活动后我会超时。 I want to capture that and click on 'Continue' when that alert comes up so that the test is not interrupted.
我想捕获它并在出现该警报时单击“继续”,这样测试就不会中断。
Since this alert is not triggered by any action, it is challenging to predict when this occurs.由于此警报不是由任何操作触发的,因此很难预测何时发生。 Any suggestions on how this can be handled?
关于如何处理这个问题的任何建议?
Performing a check like below after each and every step doesn't look like an ideal solution.在每一步之后执行如下检查似乎不是一个理想的解决方案。
if (alert.exists()){
button.click;
}
You can try smth like this:你可以这样尝试:
WebDriverWait wait = new WebDriverWait(driver, 30);
try {
wait.until(ExpectedConditions.alertIsPresent());
driver.switchTo().alert().accept();
} catch (Exception e) {
System.out.println(" no alert visible after 30 sec.");
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.