0
我正在嘗試自動化混合應用程序,我在其中不斷切換Web和本機視圖。Appium - 在上下文中找到現有的chromedriver;使用它
我使用的功能
public void switchToWebContext() throws InterruptedException {
Set<String> contextNames = appiumDriver.getContextHandles();
for (String context : contextNames) {
System.out.println("Context is" + context);
if (context.contains("WEBVIEW")) {
getAppiumWebDriver().context(context);
displayLog("Mobile Web View switched");
}
}
}
public void switchToNativeContext() {
Set<String> contextNames = getAppiumWebDriver().getContextHandles();
for (String context : contextNames) {
if (context.contains("NATIVE")) {
displayLog("Native View found");
getAppiumWebDriver().context(context);
}
}
}
我在這裏的問題是,在第一次的導航需要流量正常,但在第二輪我得到這個錯誤
Found existing chromedriver for context
我等待後幾分鐘我得到的錯誤是
[debug] [JSONWP Proxy] Proxying [GET /url] to [GET http://127.0.0.1:8000/wd/hub/session/ad84071a45fc33c30541cc85681dab7b/url] with no body
[debug] [AndroidDriver] ChromeDriver is not associated with a window. Re-initializing the session.
[Chromedriver] Restarting chromedriver
[debug] [Chromedriver] Changed state to 'restarting'
[debug] [JSONWP Proxy] Proxying [DELETE /] to [DELETE http://127.0.0.1:8000/wd/hub/session/ad84071a45fc33c30541cc85681dab7b] with no body
有人可以幫我解決這個問題嗎?有沒有什麼辦法中,我可以使用現有的上下文或存儲它以某種方式以備將來使用
我會哄Appium 1.6.5在Windows 10