DesiredCapabilities 的配置如下:

desiredCapabilities = new DesiredCapabilities();
desiredCapabilities.setCapability(MobileCapabilityType.PLATFORM_NAME, "Android");
desiredCapabilities.setCapability(MobileCapabilityType.PLATFORM_VERSION, "7.1.1");
desiredCapabilities.setCapability(MobileCapabilityType.DEVICE_NAME, "MEIZU PRO 6s");
//desiredCapabilities.setCapability(MobileCapabilityType.AUTOMATION_NAME, "UiAutomator2");
desiredCapabilities.setCapability(MobileCapabilityType.BROWSER_NAME, "");
desiredCapabilities.setCapability(MobileCapabilityType.AUTO_WEBVIEW, true);
desiredCapabilities.setCapability(MobileCapabilityType.NO_RESET, true);

//android only
desiredCapabilities.setCapability(AndroidMobileCapabilityType.APP_ACTIVITY, "com.company.department.project.beta.MainActivity");
desiredCapabilities.setCapability(AndroidMobileCapabilityType.APP_PACKAGE, "com.company.department.project.beta");
desiredCapabilities.setCapability(AndroidMobileCapabilityType.UNICODE_KEYBOARD, true);
desiredCapabilities.setCapability(AndroidMobileCapabilityType.RESET_KEYBOARD, true);

appium 的 chromedriver(C:\Users\310236939\AppData\Local\Programs\Appium\resources\app\node_modules\appium\node_modules\appium-chromedriver\chromedriver\win)版本配置为 2.22.397933,手机上的 webview 的版本为:Chrome version on device: Chrome/51.0.2074.203,但是运行 testcase 时总是报错:

[Chromedriver] Unable to automate Chrome version because it is too old for this version of Chromedriver.
[Chromedriver] Chrome version on device: Chrome/51.0.2074.203
[Chromedriver] Please see 'https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/web/chromedriver.md'
[Chromedriver] Error: Failed to start Chromedriver session: An unknown server-side error occurred while processing the command. Original error: unknown error: Chrome version must be >= 49.0.2623.0
[Chromedriver]   (Driver info: chromedriver=2.22.397933 (1cab651507b88dec79b2b2a22d1943c01833cc1b),platform=Windows NT 6.1.7601 SP1 x86_64)
[Chromedriver]     at Object.wrappedLogger.errorAndThrow (C:\Users\310236939\AppData\Local\Programs\Appium\resources\app\node_modules\appium\node_modules\appium-support\lib\logging.js:78:13)
[Chromedriver]     at Chromedriver.callee$2$0$ (C:\Users\310236939\AppData\Local\Programs\Appium\resources\app\node_modules\appium\node_modules\appium-chromedriver\lib\chromedriver.js:449:13)
[Chromedriver]     at tryCatch (C:\Users\310236939\AppData\Local\Programs\Appium\resources\app\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:67:40)
[Chromedriver]     at GeneratorFunctionPrototype.invoke [as _invoke] (C:\Users\310236939\AppData\Local\Programs\Appium\resources\app\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:315:22)
[Chromedriver]     at GeneratorFunctionPrototype.prototype.(anonymous function) [as throw] (C:\Users\310236939\AppData\Local\Programs\Appium\resources\app\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:100:21)
[Chromedriver]     at GeneratorFunctionPrototype.invoke (C:\Users\310236939\AppData\Local\Programs\Appium\resources\app\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:136:37)
[Chromedriver]     at run (C:\Users\310236939\AppData\Local\Programs\Appium\resources\app\webpack:\~\babel-polyfill\~\core-js\modules\es6.promise.js:75:1)
[Chromedriver]     at C:\Users\310236939\AppData\Local\Programs\Appium\resources\app\webpack:\~\babel-polyfill\~\core-js\modules\es6.promise.js:92:1
[Chromedriver]     at flush (C:\Users\310236939\AppData\Local\Programs\Appium\resources\app\webpack:\~\babel-polyfill\~\core-js\modules\_microtask.js:18:1)
[Chromedriver]     at process._tickCallback (internal/process/next_tick.js:61:11)

我的版本都是照着 google 的配置的,而且也都是匹配的,为什么还总是会报版本的 error 啊?


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