【问题标题】:How to handle iOS App session timeouts using Java and Appium in Mobile Native如何在 Mobile Native 中使用 Java 和 Appium 处理 iOS App 会话超时
【发布时间】:2020-11-24 23:53:46
【问题描述】:

我正在开发一个应用程序,在一段时间不活动后我会超时。我想捕捉它并在警报出现时单击“继续”,这样测试就不会中断。

由于此警报不是由任何操作触发的,因此很难预测何时会发生这种情况。有关如何处理此问题的任何建议?

在每一步之后执行如下检查似乎不是一个理想的解决方案。

if (alert.exists()){
button.click;
}

【问题讨论】:

    标签: java ios testing automation appium


    【解决方案1】:

    你可以这样试试:

                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.");
                }
    

    【讨论】:

      猜你喜欢
      • 2021-08-27
      • 1970-01-01
      • 2017-12-17
      • 1970-01-01
      • 2015-03-23
      • 1970-01-01
      • 2018-08-18
      • 2018-01-24
      • 1970-01-01
      相关资源
      最近更新 更多