1

我有一組使用https://github.com/camme/webdriverjs編寫的驗收測試。我希望通過Selenium Server(WebDriver)和Sauce Labs對真正的瀏覽器運行測試。 Firefox啓動正常,但Chromium(Debian Wheezy包中的30.0.1599.101)不支持。通過只設置{ desiredCapabilities: { browserName: "chrome" } }我得到ERROR COULDNT GET A SESSION ID和硒Server控制檯輸出顯示Selenium服務器無法啓動Chromium

WARN - Exception: The path to the driver executable must be set by the webdriver.chrome.driver system property; for more information, see http://code.google.com/p/selenium/wiki/ChromeDriver. The latest version can be downloaded from http://code.google.com/p/chromedriver/downloads/list 

如果我啓動Selenium服務器與出現-Dwebdriver.chrome.driver=/usr/bin/chromium新的瀏覽器窗口,但測試不會開始運行,超時後我得到同樣的ERROR COULDNT GET A SESSION ID和硒Server控制檯輸出顯示

Created new window in existing browser session. 13:43:25.775 WARN - Exception thrown java.util.concurrent.ExecutionException: org.openqa.selenium.WebDriverException: java.lang.reflect.InvocationTargetException 
[...] 
Caused by: org.openqa.selenium.WebDriverException: java.lang.reflect.InvocationTargetException 
[...] 
Caused by: org.openqa.selenium.remote.UnreachableBrowserException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure. 
[...] 
Caused by: org.openqa.selenium.WebDriverException: Timed out waiting for driver server to start. 
+0

顯然,我需要安裝Chrome的驅動程序和點'webdriver.chrome.driver'給司機,而不是瀏覽器的二進制文件。 –

+0

現在,通過Chrome驅動程序,我可以更進一步。 Chromium開始但是測試在開始時失敗,出現'未知命令'WaitForAllTabsToStopLoading''作爲響應。 –

回答

2

請以正確的方式設置ChromeDriver可執行文件路徑。

System.setProperty( 「webdriver.chrome.driver」, 「/路徑/到/ chromedriver」) //然後,你的驅動程序實例

webdriver的驅動程序=新ChromeDriver();

更多信息,ChromeDriver here

+1

在意識到我需要Chrome驅動程序後進一步瞭解。謝謝。 –

+0

不錯,它幫助... – Manoj