Mobile appium移动自动化中的上下文切换问题

Mobile appium移动自动化中的上下文切换问题,mobile,automation,appium,Mobile,Automation,Appium,嗨,我尝试在移动自动化中从本机页面切换到混合页面。它抛出一个错误chrome驱动程序已经在使用中。如何在移动自动化中修复它 如果您需要使用java自动化android应用程序,您可以使用以下方法在上下文之间切换 public final String WEBVIEW = "WEBVIEW_com.maxsoft.testextractor"; public final String NATIVE_APP = "NATIVE_APP"; public void switchContextTo(S

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

如果您需要使用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
        }
    }