2015-10-20 104 views
4

我試圖啓動硒的獨立服務器(https://www.npmjs.com/package/selenium-standalone),它拋出一個錯誤:指定要chromedriver路徑硒獨立

14:19:09 /usr/local/lib/node_modules/selenium-standalone/bin/selenium-standalone:54 
14:19:09   throw err; 
14:19:09    ^
14:19:09 Error: Missing /usr/local/lib/node_modules/selenium-standalone/.selenium/chromedriver/2.18-x64-chromedriver 
14:19:09  at /usr/local/lib/node_modules/selenium-standalone/lib/check-paths-existence.js:15:20 
14:19:09  at Object.cb [as oncomplete] (fs.js:169:19) 
14:19:09 Build step 'Execute shell' marked build as failure 

硒服務器在路徑尋找chromedriver

/usr/local/lib/node_modules/selenium-standalone/.selenium/chromedriver/2.18-x64-chromedriver

默認情況下。

是否可以在運行服務器時在命令行指定chromedriver位置?例如:

selenium-standalone -Dwebdriver.chrome.driver=<path_to_chromedriver> start 

回答

3

是否有可能您需要先安裝它!

➜ ~ selenium-standalone install 
---------- 
selenium-standalone installation starting 
---------- 

--- 
selenium install: 
from: https://selenium-release.storage.googleapis.com/2.53/selenium-server-standalone-2.53.0.jar 
to: /usr/local/lib/node_modules/selenium-standalone/.selenium/selenium-server/2.53.0-server.jar 
--- 
chrome install: 
from: https://chromedriver.storage.googleapis.com/2.21/chromedriver_mac32.zip 
to: /usr/local/lib/node_modules/selenium-standalone/.selenium/chromedriver/2.21-x64-chromedriver 


selenium-standalone installation [================== ] 91% 8.2s 

selenium-standalone提供此命令來幫助您下載和安裝chromedriver。此外,它提供命令來設置和下載硒,鉻合金和體系結構的不同選項(我沒有找到設置路徑的命令)

# choose selenium version 
selenium-standalone install --version=2.45.0 --baseURL=https://selenium-release.storage.googleapis.com 

# choose chrome driver version 
selenium-standalone install --drivers.chrome.version=2.15 --drivers.chrome.baseURL=https://chromedriver.storage.googleapis.com 

# choose ie driver architecture 
selenium-standalone start --drivers.ie.arch=ia32 --drivers.ie.baseURL=https://selenium-release.storage.googleapis.com