Background – webdriver.chrome.driver system property
I was following along Selenium’s quick-start guide but kept getting an error, “The path to the driver executable must be set by the webdriver.chrome.driver system property“. Most of the answers I found were for Java and simply set the value in code. I tried a similar fix in C# to no avail. Finally, I found a solution that works that sets the values as command-line parameters when I launch the Node.
Files
- Chrome Driver – https://sites.google.com/a/chromium.org/chromedriver/downloads
- Gecko (Firefox) Driver – https://github.com/mozilla/geckodriver/releases
- Selenium Server Standalone – http://www.seleniumhq.org/download/
All files were placed in C:\Selenium. An entry was added to my Windows PATH variable by:
- Right-click “This PC” and select “Properties”
- In the left navigation menu, select “Advanced system settings”
- Select the “Advanced” tab
- Select “Environment Variables…”
- Under “System variables” select “Path” and then select “Edit…”
- Select “New”
- Enter
C:\Selenium\
- Select “OK”
Start the Hub
The following script will start the Grid Hub (on the default port of 4444).
cd C:\Selenium java -jar selenium-server-standalone-3.0.0.jar -role hub
Start the Node
The following script will start a Grid Node (on the default port of 5555). It will also register the locations of the Chrome and Firefox WebDrivers (respectively).
cd C:\Selenium java -Dwebdriver.chrome.driver=C:\Selenium\chromedriver.exe -Dwebdriver.gecko.driver=C:\Selenium\geckodriver.exe -jar selenium-server-standalone-3.0.0.jar -role node -hub http://localhost:4444/grid/register