自動化測試研究,chromedriver.exe 版本不行
阿新 • • 發佈:2019-01-27
前提條件,
1、我的電腦是已經配置了代理,可以翻牆的。
而且,關閉所有翻牆軟體,清除快取,清除瀏覽器、代理設定,,,,某些本來應該可以訪問的網站,比如cucumberjs seleniumjs 等等網站,也是不能訪問狀態。
2、何總給的demo ,我的桌上型電腦 啟動報錯。
其他的電腦,在maven 命令啟動報錯, grunt firefox 啟動報錯。
但是,我的桌上型電腦 grunt chrome 啟動也是報錯的,錯誤如下:
Running "env:chrome" (env) task Running "jshint:all" (jshint) task >> 8 files lint free. Running "exec:run_chrome" (exec) task Feature: 法律社專案,印務測試用例 材料出庫測試 @first Scenario: xin jian li xiang shen qing shalei √ Given use name "shalei" pwd "shalei" login system √ Then open the to do item √ Then open all tasks √ Given open task by √ When open sort √ Then open float √ Then According to the task information "編印務流程-紙質圖書-123123" and task name "新建立項申請" to handle the process Failures: 1) Scenario: xin jian li xiang shen qing - features\float-test.feature:21 Step: After Step Definition: features\support\hooks.js:10 Message: Error: ECONNREFUSED connect ECONNREFUSED 127.0.0.1:54536 at ClientRequest.<anonymous> (W:\AutoTestProject\LawEditorial-autotest\node_modules\selenium-webdriver\http\index.js:381:15) at emitOne (events.js:77:13) at ClientRequest.emit (events.js:169:7) at Socket.socketErrorListener (_http_client.js:269:9) at emitOne (events.js:77:13) at Socket.emit (events.js:169:7) at emitErrorNT (net.js:1269:8) at nextTickCallbackWith2Args (node.js:442:9) at process._tickCallback (node.js:356:17) From: Task: WebDriver.manage().window().setSize(1920, 1080) at Driver.schedule (W:\AutoTestProject\LawEditorial-autotest\node_modules\selenium-webdriver\lib\webdriver.js:377:17) at Window.setSize (W:\AutoTestProject\LawEditorial-autotest\node_modules\selenium-webdriver\lib\webdriver.js:1402:25) at Object.<anonymous> (W:\AutoTestProject\LawEditorial-autotest\features\support\world.js:24:26) at Module._compile (module.js:409:26) at Object.Module._extensions..js (module.js:416:10) at Module.load (module.js:343:32) at Function.Module._load (module.js:300:12) at Module.require (module.js:353:17) at require (internal/module.js:12:17) at Object.module.exports (W:\AutoTestProject\LawEditorial-autotest\features\step_definitions\base.step.js:8:15) 1 scenario (1 failed) 7 steps (7 passed) 0m02.665s >> W:\AutoTestProject\LawEditorial-autotest\node_modules\cucumber\lib\cucumber\runtime\event_broadcaster.js:30 >> throw error; >> ^ >> >> Error: ECONNREFUSED connect ECONNREFUSED 127.0.0.1:54536 >> at ClientRequest.<anonymous> (W:\AutoTestProject\LawEditorial-autotest\node_modules\selenium-webdriver\http\index.js:381:15) >> at emitOne (events.js:77:13) >> at ClientRequest.emit (events.js:169:7) >> at Socket.socketErrorListener (_http_client.js:269:9) >> at emitOne (events.js:77:13) >> at Socket.emit (events.js:169:7) >> at emitErrorNT (net.js:1269:8) >> at nextTickCallbackWith2Args (node.js:442:9) >> at process._tickCallback (node.js:356:17) >> From: Task: WebDriver.quit() >> at Driver.schedule (W:\AutoTestProject\LawEditorial-autotest\node_modules\selenium-webdriver\lib\webdriver.js:377:17) >> at Driver.quit (W:\AutoTestProject\LawEditorial-autotest\node_modules\selenium-webdriver\lib\webdriver.js:443:23) >> at W:\AutoTestProject\LawEditorial-autotest\features\support\hooks.js:26:11 >> at nextTickCallbackWith0Args (node.js:420:9) >> at Immediate._tickCallback [as _onImmediate] (node.js:349:13) >> at processImmediate [as _immediateCallback] (timers.js:383:17) >> Exited with code: 7. Warning: Task "exec:run_chrome" failed. Use --force to continue. Aborted due to warnings.
一直以為是代理問題,在 proxy.js 檔案中設定了很長時間不能用。
也在 work.js 啟動 driver 裡面 也設定了,還是不行。
用 grunt chrome 命令啟動測試用例,曾經偶爾成功過,不知道因為啥原因後來也不行了。
今天看見兩篇文章,連結如下。
把chromedriver.exe版本換成 2.24 就沒有問題了。