被测 app 是混合型 app,某个功能需要切换 webview。代码如下:

DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("platformName","Android");
capabilities.setCapability("deviceName","4d00c2ccb0dd6063");

capabilities.setCapability("automationName","Android"); 
capabilities.setCapability(CapabilityType.BROWSER_NAME, "");
capabilities.setCapability(CapabilityType.VERSION, "4.4");
Set<String> contextNames = driver.getContextHandles();
for (String contextName : contextNames) {

  System.out.println(contextName); // 用于返回被测app是NATIVE_APP还是WEBVIEW,如果两者都有就是混合型App
  if (contextName.contains("WEBVIEW")) 
      driver.context(contextName);

}

运行到
driver.context(contextName);
时,appium 报错,错误日志如下:

error: Chromedriver create session did not work. Status was 200 and body was{"sessionId":"276ad6edf24e1798bd79b4e5aabfc1bc","status":13,"value":{"message":"unknown error: Chrome version must be >= 33.0.1750.0\n  (Driver info: chromedriver=2.10.267521,platform=Windows NT 6.1 SP1 x86_64)"}}
info: [debug] Responding to client with error: {"status":13,"value":{"message":"An unknown server-side error occurred while processing the command. (Original error: Did not get session redirect from Chromedriver)","origValue":"Did not get session redirect from Chromedriver"},"sessionId":"f8d68152-f368-47a4-9a3d-8c66af8b84e4"}

请教问题的原因和解决办法。。无限感激!!!


↙↙↙阅读原文可查看相关链接,并与作者交流