自動化專案部署過程可能遇到的各種BUG
不斷補充中。。
0、maven 啟動 測試用例 報錯問題。
錯誤日誌如下。
***********************日誌bigan*************************************
***********************日誌end*************************************[ERROR] Failed to execute goal com.github.eirslett:frontend-maven-plugin:1.0:npm (npm install) on project aip-demo-webdriver.js: Failed to run task: 'npm install' failed. java.io.IOException: Cannot run program "W:\AutoTestProject\LawEditorial-autotest\node\node.exe" (in directory "W:\AutoTestProject\LawEditorial-autotest"): CreateProcess error=193, %1 ??????Ч?? Win32 ??ó -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
能導致這個錯誤的原因有很多。。因此沒找到解決方法,也是英語不好的原因。
http://stackoverflow.com/questions/25511402/java-io-ioexception-cannot-run-program-createprocess-error-193-1-is-not-a
http://stackoverflow.com/questions/12637203/why-does-createprocess-give-error-193-1-is-not-a-valid-win32-app
1、代理設定問題。
win10 系統,lantern 翻牆軟體,啟動翻牆軟體後,啟動專案一直報錯,firefox 拒絕訪問,chrome 瀏覽器崩潰。
2、chromedriver.exe 找不到。
需要把 chromedriver.exe放到專案根目錄下。 否則會報錯,讓你下載 chromedriver.exe ,
也可以配置path ,指定到 .exe 的目錄(好像是可以?)
或者,改 檔案 node_modules \ selenium-webdriver \ chrome.js
改 第 183行。
遮蔽的那句,代替 沒有遮蔽的那句。let exe = opt_exe || io.findInPath(CHROMEDRIVER_EXE, true); //let exe = opt_exe || 'C:\\ASDF\\AAA\\chromedriver.ese';
要用 雙 反斜槓 ,指明路徑就可以了。
3、chrome 可以 執行,firefox 不可以執行。
3.1、chrome 可以成功執行,而firefox 不啟動瀏覽器,直接秒退 ,控制檯報錯。
是因為你的 firefox 版本太低,升級到 48及以上版本就可以了。
3.2、chrome 可以執行,firefox ,不秒退,但是不能執行,報錯如下:
****************************************** 錯誤日誌begin*****************************************
Failures:
1) Scenario: Test The ideal of the topic - features\abc.feature:8
Step: After
Step Definition: features\support\hooks.js:10
Message:
Error: Timed out waiting for the WebDriver server at http://127.0.0.1:49897/hub
at Error (native)
at onError (W:\AutoTestProject\LawEditorial-autotest\node_modules\selenium-webdriver\http\util.js:87:11)
at ManagedPromise.invokeCallback_ (W:\AutoTestProject\LawEditorial-autotest\node_modules\selenium-webdriver\lib\promise.js:1379:14)
at TaskQueue.execute_ (W:\AutoTestProject\LawEditorial-autotest\node_modules\selenium-webdriver\lib\promise.js:2913:14)
at TaskQueue.executeNext_ (W:\AutoTestProject\LawEditorial-autotest\node_modules\selenium-webdriver\lib\promise.js:2896:21)
at W:\AutoTestProject\LawEditorial-autotest\node_modules\selenium-webdriver\lib\promise.js:2775:27
at W:\AutoTestProject\LawEditorial-autotest\node_modules\selenium-webdriver\lib\promise.js:639:7
at process._tickCallback (node.js:369:9)
From: Task: WebDriver.createSession()
at Function.createSession (W:\AutoTestProject\LawEditorial-autotest\node_modules\selenium-webdriver\lib\webdriver.js:329:24)
at Driver (W:\AutoTestProject\LawEditorial-autotest\node_modules\selenium-webdriver\firefox\index.js:386:38)
at Builder.build (W:\AutoTestProject\LawEditorial-autotest\node_modules\selenium-webdriver\builder.js:467:16)
at buildFirefoxdrive (W:\AutoTestProject\LawEditorial-autotest\features\support\world.js:15:37)
at Object.<anonymous> (W:\AutoTestProject\LawEditorial-autotest\features\support\world.js:20:14)
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)
From: Task: WebDriver.manage().timeouts().implicitlyWait(50000)
at Driver.schedule (W:\AutoTestProject\LawEditorial-autotest\node_modules\selenium-webdriver\lib\webdriver.js:377:17)
at Timeouts.implicitlyWait (W:\AutoTestProject\LawEditorial-autotest\node_modules\selenium-webdriver\lib\webdriver.js:1287:25)
at new World (W:\AutoTestProject\LawEditorial-autotest\features\support\world.js:38:28)
1 scenario (1 failed)
4 steps (4 passed)
0m46.457s
>> W:\AutoTestProject\LawEditorial-autotest\node_modules\cucumber\lib\cucumber\runtime\event_broadcaster.js:30
>> throw error;
>> ^
>>
>> Error: Timed out waiting for the WebDriver server at http://127.0.0.1:49897/hub
>> at Error (native)
>> at onError (W:\AutoTestProject\LawEditorial-autotest\node_modules\selenium-webdriver\http\util.js:87:11)
>> at ManagedPromise.invokeCallback_ (W:\AutoTestProject\LawEditorial-autotest\node_modules\selenium-webdriver\lib\promise.js:1379:14)
>> at TaskQueue.execute_ (W:\AutoTestProject\LawEditorial-autotest\node_modules\selenium-webdriver\lib\promise.js:2913:14)
>> at TaskQueue.executeNext_ (W:\AutoTestProject\LawEditorial-autotest\node_modules\selenium-webdriver\lib\promise.js:2896:21)
>> at W:\AutoTestProject\LawEditorial-autotest\node_modules\selenium-webdriver\lib\promise.js:2775:27
>> at W:\AutoTestProject\LawEditorial-autotest\node_modules\selenium-webdriver\lib\promise.js:639:7
>> at process._tickCallback (node.js:369:9)
>> From: Task: WebDriver.createSession()
>> at Function.createSession (W:\AutoTestProject\LawEditorial-autotest\node_modules\selenium-webdriver\lib\webdriver.js:329:24)
>> at Driver (W:\AutoTestProject\LawEditorial-autotest\node_modules\selenium-webdriver\firefox\index.js:386:38)
>> at Builder.build (W:\AutoTestProject\LawEditorial-autotest\node_modules\selenium-webdriver\builder.js:467:16)
>> at buildFirefoxdrive (W:\AutoTestProject\LawEditorial-autotest\features\support\world.js:15:37)
>> at Object.<anonymous> (W:\AutoTestProject\LawEditorial-autotest\features\support\world.js:20:14)
>> 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)
>> From: Task: WebDriver.manage().timeouts().implicitlyWait(50000)
>> at Driver.schedule (W:\AutoTestProject\LawEditorial-autotest\node_modules\selenium-webdriver\lib\webdriver.js:377:17)
>> at Timeouts.implicitlyWait (W:\AutoTestProject\LawEditorial-autotest\node_modules\selenium-webdriver\lib\webdriver.js:1287:25)
>> at new World (W:\AutoTestProject\LawEditorial-autotest\features\support\world.js:38:28)
>> 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 Driver.onQuit.quit (W:\AutoTestProject\LawEditorial-autotest\node_modules\selenium-webdriver\firefox\index.js:393:14)
>> 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)
>> Exited with code: 7.
Warning: Task "exec:run_firefox" failed. Use --force to continue.
Aborted due to warnings.
****************************************** 錯誤日誌end*****************************************這個錯誤的產生原因有很多中情況。
這個錯誤,我還沒有解決,-.-!