Appium 切换上下文环境,代码如下:

    private void switchToContext(String sContext) {
        LogManager.getLogger(this.getClass()).info("Swith to Context: " + sContext);
        Set<String> contextNames = driver.getContextHandles();
        LogManager.getLogger(this.getClass()).info("Exists Contexts: " + contextNames.toString());
        for (String contextName : contextNames) {
            if (contextName.contains(sContext)) {
                driver.context(contextName);
                LogManager.getLogger(this.getClass()).info("Swith to Context SUCCESS.");
                break;
            }
        }
    }

 

相关文章:

  • 2022-12-23
  • 2021-05-24
  • 2021-04-16
  • 2021-11-14
  • 2021-07-13
  • 2022-01-18
猜你喜欢
  • 2021-11-23
  • 2022-12-23
相关资源
相似解决方案