我正在运行一个Meteor应用程序并使用CircleCI。对于集成测试,我使用selenium-webdriver 3.6.0,它只支持Chrome版本74。问题是我不能安装Chrome 74,它会自动安装76版本,我得到了这个错误:
This version of ChromeDriver only supports Chrome version 74
如果我试图更新selenium-webdriver
,我会得到这个错误:
The engine "node" is incompatible with this module. Expected version ">= 10.15.0". Got "8.15.1"
我无法更新Node,因为我使用的是Meteor,它使用Node 8.15.1。
完全错误:
I20190809-11:38:44.138(-3)? --------------------------------
I20190809-11:38:44.138(-3)? --- RUNNING APP CLIENT TESTS ---
I20190809-11:38:44.139(-3)? --------------------------------
W20190809-11:38:56.725(-3)? (STDERR) /home/vallo/app/node_modules/selenium-webdriver/lib/promise.js:2626
W20190809-11:38:56.726(-3)? (STDERR) throw error;
W20190809-11:38:56.726(-3)? (STDERR) ^
W20190809-11:38:56.726(-3)? (STDERR)
W20190809-11:38:56.726(-3)? (STDERR) SessionNotCreatedError: session not created: This version of ChromeDriver only supports Chrome version 74
W20190809-11:38:56.727(-3)? (STDERR) (Driver info: chromedriver=74.0.3729.6 (255758eccf3d244491b8a1317aa76e1ce10d57e9-refs/branch-heads/3729@{#29}),platform=Linux 5.0.0-23-generic x86_64)
W20190809-11:38:56.727(-3)? (STDERR) at Object.checkLegacyResponse (/home/vallo/app/node_modules/selenium-webdriver/lib/error.js:546:15)
W20190809-11:38:56.727(-3)? (STDERR) at parseHttpResponse (/home/vallo/app/node_modules/selenium-webdriver/lib/http.js:509:13)
W20190809-11:38:56.727(-3)? (STDERR) at doSend.then.response (/home/vallo/app/node_modules/selenium-webdriver/lib/http.js:441:30)
W20190809-11:38:56.728(-3)? (STDERR) at /home/vallo/.meteor/packages/promise/.0.11.2.1rxqxdq.d4m4g++os+web.browser+web.browser.legacy+web.cordova/npm/node_modules/meteor-promise/fiber_pool.js:43:40
W20190809-11:38:56.728(-3)? (STDERR) From: Task: WebDriver.createSession()
W20190809-11:38:56.730(-3)? (STDERR) at Function.createSession (/home/vallo/app/node_modules/selenium-webdriver/lib/webdriver.js:769:24)
W20190809-11:38:56.733(-3)? (STDERR) at Function.createSession (/home/vallo/app/node_modules/selenium-webdriver/chrome.js:761:15)
W20190809-11:38:56.734(-3)? (STDERR) at createDriver (/home/vallo/app/node_modules/selenium-webdriver/index.js:170:33)
W20190809-11:38:56.734(-3)? (STDERR) at Builder.build (/home/vallo/app/node_modules/selenium-webdriver/index.js:642:16)
W20190809-11:38:56.734(-3)? (STDERR) at startChrome (packages/meteortesting:browser-tests/browser/chromedriver.js:46:136)
W20190809-11:38:56.735(-3)? (STDERR) at startBrowser (packages/meteortesting:browser-tests/server.js:23:7)
W20190809-11:38:56.735(-3)? (STDERR) at clientTests (packages/meteortesting:mocha/server.js:140:3)
W20190809-11:38:56.735(-3)? (STDERR) at serverTests (packages/meteortesting:mocha/server.js:185:7)
W20190809-11:38:56.735(-3)? (STDERR) at mochaInstance.run.failureCount (packages/meteortesting:mocha/server.js:120:13)
W20190809-11:38:56.735(-3)? (STDERR) at done (/home/vallo/.meteor/packages/meteortesting_mocha-core/.6.1.2.1dvruze.m99s++os+web.browser+web.browser.legacy+web.cordova/npm/node_modules/mocha/lib/mocha.js:838:7)
W20190809-11:38:56.736(-3)? (STDERR) at Runner.<anonymous> (/home/vallo/.meteor/packages/meteortesting_mocha-core/.6.1.2.1dvruze.m99s++os+web.browser+web.browser.legacy+web.cordova/npm/node_modules/mocha/lib/runner.js:918:5)
W20190809-11:38:56.736(-3)? (STDERR) at emitNone (events.js:111:20)
W20190809-11:38:56.736(-3)? (STDERR) at Runner.emit (events.js:208:7)
W20190809-11:38:56.736(-3)? (STDERR) at /home/vallo/.meteor/packages/meteortesting_mocha-core/.6.1.2.1dvruze.m99s++os+web.browser+web.browser.legacy+web.cordova/npm/node_modules/mocha/lib/runner.js:903:12
W20190809-11:38:56.736(-3)? (STDERR) at /home/vallo/.meteor/packages/meteortesting_mocha-core/.6.1.2.1dvruze.m99s++os+web.browser+web.browser.legacy+web.cordova/npm/node_modules/mocha/lib/runner.js:772:9
W20190809-11:38:56.737(-3)? (STDERR) at next (/home/vallo/.meteor/packages/meteortesting_mocha-core/.6.1.2.1dvruze.m99s++os+web.browser+web.browser.legacy+web.cordova/npm/node_modules/mocha/lib/runner.js:362:14)
error Command failed with exit code 1.
安装的chromedriver版本为76,路径正确。
vallo@ubuntu:~$ chromedriver -v
ChromeDriver 76.0.3809.68 (420c9498db8ce8fcd190a954d51297672c1515d5-refs/branch-heads/3809@{#864})
vallo@ubuntu:~$ whereis chromedriver
chromedriver: /usr/bin/chromedriver
发布于 2019-08-09 23:56:34
最好的解决方案是找到一个74版本的Chrome。
另一种不太好的解决方案是禁用客户端测试,以至少避免CI问题,并让服务器端测试继续运行:
https://github.com/meteortesting/meteor-mocha#run-only-server-or-only-client-tests
将TEST_CLIENT=0
添加到脚本命令中,客户端测试将被跳过。
https://stackoverflow.com/questions/57432785
复制相似问题