Alexander Mills
Alexander Mills

Reputation: 100190

How to set the "webdriver.chrome.driver" property with Protractor

I am getting this error:

[01:10:42] E/launcher - The path to the driver executable must be set by the webdriver.chrome.driver system property; for more information, see https://github.com/SeleniumHQ/selenium/wiki/ChromeDriver. The latest version can be downloaded from http://chromedriver.storage.googleapis.com/index.html
[01:10:42] E/launcher - WebDriverError: The path to the driver executable must be set by the webdriver.chrome.driver system property; for more information, see https://github.com/SeleniumHQ/selenium/wiki/ChromeDriver. The latest version can be downloaded from http://chromedriver.storage.googleapis.com/index.html
    at Object.checkLegacyResponse (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/error.js:546:15)
    at parseHttpResponse (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/http.js:509:13)
    at doSend.then.response (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/http.js:441:30)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:160:7)

I need to set the webdriver.chrome.driver property, but I can't find any docs on how to do this with Protractor, does anyone know?

If I had this to my protractor.conf.js:

 chrome:{
    driver:  process.env.CDT_CHROMEDRIVER || '/usr/local/bin/chromedriver'
  },

then I get this error:

unknown error: no chrome binary at /usr/bin/google-chrome

Upvotes: 7

Views: 13011

Answers (1)

yong
yong

Reputation: 13722

Case 1 When you set DirectConnet to true in protractor conf file

Option 1: set in protractor conf file

exports.config = {
  chromeDriver: './node_modules/protractor/node_modules/webdriver-manager/selenium/chromedriver'
};

Note: If use relative path, it relatived to the config file folder

Option 2: pass-in in protractor command line, it will overwrite the one in conf file.

protractor conf.js --chromeDriver='./node_modules/protractor/node_modules/webdriver-manager/selenium/chromedriver'

Note: If use relative path, it relative to the foler where command executed under, calculated by process.cwd()

Case 2 When you set selenuimAddress to local/remote selenium server

Option 1: use npm package webdriver-manager to help to update and start selenium server, it can calculate the webdriver path automatically, no need you to tell where is.

Option 2: start selenium server by java command and specify -Dwebdriver.chrome.driver=absolute path of chromedriver

Case 3 When you set seleniumAddress to selenium grid
the only chance you can specify webdriver.chrome.driver is when execute register cmd to register selenium node to selenium hub, you can't do anything in other place.

Upvotes: 12

Related Questions