【问题标题】:How to switch context from Native App to Web App in Appium如何在 Appium 中将上下文从 Native App 切换到 Web App
【发布时间】:2021-04-21 18:05:39
【问题描述】:

我们无法将上下文从本机应用程序切换到 Web 应用程序。 请建议我们实现这一目标的方法

【问题讨论】:

    标签: firefox appium


    【解决方案1】:

    你可以用这个

    Set contextNames = driver.getContextHandles();
    for (String contextName : contextNames) {
        if (contextName.contains(“WEBVIEW”)){
          driver.context(contextName);
        }
    }  
    

    【讨论】:

    • 这里我们只得到一个上下文名称——NativeApp。因此在尝试上述代码时无法找到 Webview 上下文。
    猜你喜欢
    • 2014-02-03
    • 1970-01-01
    • 2011-12-23
    • 1970-01-01
    • 2018-07-02
    • 2021-04-05
    • 2017-03-05
    • 2022-10-19
    • 1970-01-01
    相关资源
    最近更新 更多