7

我試圖實現的目標 在Ubuntu 14非gui上成功運行我的量角器測試無頭鍍鉻。WebDriverError:未知錯誤:Chrome未能啓動:退出異常

設置 使用多個參考頁我已經設法成功安裝:Xvfb來的Chrome瀏覽器最新的3.3.0量角器Java 7中(也試過與Java 8),並設置LOCAL_HOME。此外,管理使用開始的Xvfb this reference.

量角器的conf

exports.config = { 
    baseUrl: 'http://<qa environment>', 
    framework: 'jasmine', 
    seleniumAddress: 'http://localhost:4444/wd/hub', 
    jasmineNodeOpts: { 
     showColors:true, 
     defaultTimeoutInterval: 2500000 
    }, 
    capabilities: { 
    'browserName': 'chrome' 
    }, 

    specs: ['administration/*-spec.js'], //'signinandout/*-spec.js', 'homepage/*-spec.js', 
    onPrepare: function(){ 
     //browser.driver.manage().window().setSize(1280, 1080); 
    } 
} 

異常堆棧跟蹤:

/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/error.js:26 constructor(opt_error) { ^WebDriverError: unknown error: Chrome failed to start: exited abnormally (Driver info: chromedriver=2.21.371461 (633e689b520b25f3e264a2ede6b74ccc23cb636a),platform=Linux 3.13.0-87-generic x86_64) (WARNING: The server did not provide any stacktrace information) Command duration or timeout: 60.16 seconds Build info: version: '2.52.0', revision: '4c2593c', time: '2016-02-11 19:06:42' System info: host: 'vagrant-ubuntu-trusty-64', ip: '10.0.2.15', os.name: 'Linux', os.arch: 'amd64', os.version: '3.13.0-87-generic', java.version: '1.7.0_101' Driver info: org.openqa.selenium.chrome.ChromeDriver at WebDriverError (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/error.js:26:26) at Object.checkLegacyResponse (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/error.js:580:13) at /usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver.js:64:13 at Promise.invokeCallback_ (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:1329:14) at TaskQueue.execute_ (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:2790:14) at TaskQueue.executeNext_ (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:2773:21) at /usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:2652:27 at /usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:639:7 at process._tickCallback (internal/process/next_tick.js:103:7) From: Task: WebDriver.createSession() at acquireSession (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver.js:62:22) at Function.createSession (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver.js:295:12) at Builder.build (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/builder.js:458:24) at Hosted.DriverProvider.getNewDriver (/usr/local/lib/node_modules/protractor/built/driverProviders/driverProvider.js:37:33) at Runner.createBrowser (/usr/local/lib/node_modules/protractor/built/runner.js:182:43) at /usr/local/lib/node_modules/protractor/built/runner.js:255:30 at _fulfilled (/usr/local/lib/node_modules/protractor/node_modules/q/q.js:834:54) at self.promiseDispatch.done (/usr/local/lib/node_modules/protractor/node_modules/q/q.js:863:30) at Promise.promise.promiseDispatch (/usr/local/lib/node_modules/protractor/node_modules/q/q.js:796:13) at /usr/local/lib/node_modules/protractor/node_modules/q/q.js:556:49 [01:09:14] E/launcher - Process exited with error code 1

+0

嘗試與java 8和相同的結果。目前絕對無能爲力。 –

+0

您使用什麼版本的webdriver-manager來下載二進制文件?您是否嘗試刪除這些二進制文件並再次獲取它們?在較新版本的webdriver-manager中,命令是'webdriver-manager clean'和'webdriver-manager update'。另外,你是用'webdriver-manager start'開始的嗎?如果是這樣,它開始好嗎?這些日誌中的堆棧跟蹤是什麼? – cnishina

回答

0

可能將窗口畫面的大小不匹配嘗試給在onPrepare最大化:

onPrepare: function(){ 
browser.driver.manage().window().maximize(); 
    } 
+0

感謝您的評論,但沒有幫助。不幸的是,由於依賴關係的數量,失敗的原因可能是任何事情,因此很難從這個通用的堆棧跟蹤中找出什麼是錯誤的。 –

-2

此處未指定由於Xvfb顯示而導致的錯誤。在這裏,Selenium腳本正在使用無GUI的無頭瀏覽器測試概念運行。

希望你已經使用了鍍鉻物,鉻二進制文件和XVfb。這裏chromedriver是初始化鉻二進制文件,但鉻二進制不能夠坐在顯示器與XVfb.Thats y它的拋出錯誤,因爲「Chrome無法啓動:退出異常」

請執行以下步驟之前執行ur script.Example:

USR /斌/的Xvfb(在烏爾Unix服務器(ex.putty)執行此CMD):2 -ac -screen 0 1280x1024x24 &

出口DISPLAY =:2

它將工作肯定。

相關問題