简体   繁体   English

如何在 Mobile Native 中使用 Java 和 Appium 处理 iOS App session 超时

[英]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.

相关问题 是否可以使用Java在Appium中处理iOS本机应用程序权限 - Is it possible to handle iOS native app permissions in appium using java 如何使用Java处理Appium中的本机iOS警报 - How to handle native iOS Alerts in Appium using Java ruby + appium或java + appium用于移动原生应用程序自动化 - ruby+ appium or java+appium for mobile native app automaion Appium [iOS本机应用程序]-如何使用Java滚动到特定的元素/对象? - Appium [ iOS Native app ] - How to Scroll to a specific element/object using Java? Appium:如何使用Java在iOS应用中向下滚动下拉菜单 - Appium: How to scroll down drop down in an iOS app using Java 如何使用 appium 自动化 flutter 移动应用程序? - How to automate flutter mobile app using appium? 如何在java中使用appium和selenium处理webview - How to handle webview using appium and selenium with java java ExecutorService如何处理超时 - java ExecutorService how to handle timeouts 如何使用适用于iOS appium的UI自动化JavaScript参考获取本机应用程序字体类型或样式 - how to get the native app font type or style using UI Automation JavaScript Reference for iOS appium Appium 中的 Xpath 使用 Java - 移动应用程序 - 自动化测试 - Xpath in Appium Using Java - Mobile App - Automation testing
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM