Selenium grid with WebDriverException error

My selenium grid shows an error:

org.openqa.selenium.WebDriverException: The path to the driver executable must be set by the webdriver.chrome.driver system property;

but I definitely specified it (according to my information)

System.out.println("googlechrome"); 
capability = DesiredCapabilities.chrome(); 
capability.setBrowserName("chrome"); 
capability.setPlatform(org.openqa.selenium.Platform.WINDOWS); 
System.setProperty("webdriver.chrome.driver", "D:\\testing\\zip file\\chromedriver_win_26.0.1383.0\\chromedriver.exe");
driver = new ChromeDriver();

I don’t know what went wrong. The same code worked fine last week, but now this is not happening.

+5
source share
2 answers

if you use Grid, you need to configure the Chromedriver executable in node :

 java -jar selenium-server-standalone-2.31.0.jar -role node -hub http://localhost:4444/grid/register -maxSession 15 -browser browserName="chrome",version=ANY,platform=WINDOWS,maxInstances=15 -Dwebdriver.chrome.driver=lib\chromedriver.exe

The most important part is the switch -D, which comes immediately after setting up the Chrome browser.

also, if you use multiple nodes, this path should be directed to the chromedriver executable on a specific computer (node). That's why I have it as a relative path, and not as an absolute path ...

+10

, ?

File file = new File("D:\testing\zip file\chromedriver_win_26.0.1383.0\chromedriver.exe");
system.setProperty("webdriver.chrome.driver", file.getAbsolutePath());
driver = new ChromeDriver(capability);
+1

All Articles