【问题标题】:Context switching issue in appium mobile automationappium 移动自动化中的上下文切换问题
【发布时间】:2017-10-21 07:55:57
【问题描述】:

您好,我尝试在移动自动化中从原生页面切换到混合页面。它抛出一个错误 chrome 驱动程序已在使用中。如何在移动自动化中修复它。

【问题讨论】:

    标签: mobile automation appium


    【解决方案1】:

    如果您需要使用 java 自动化 android 应用程序,您可以使用以下方法在上下文之间切换。

    public final String WEBVIEW = "WEBVIEW_com.maxsoft.testextractor";
    public final String NATIVE_APP = "NATIVE_APP";
    
    public void switchContextTo(String context){
            if (context.toLowerCase().equals(WEBVIEW.toLowerCase())) {
                androidDriver.context(WEBVIEW); // set context to WEBVIEW_1
            } else {
                androidDriver.context(NATIVE_APP); // set context to NATIVE_APP
            }
        }
    

    【讨论】:

      猜你喜欢
      • 2016-06-24
      • 2021-08-27
      • 2018-09-15
      • 2015-03-28
      • 2020-10-05
      • 2016-08-23
      • 2018-03-20
      • 1970-01-01
      • 2017-10-29
      相关资源
      最近更新 更多