Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Selenium Grid showing WebDriverException error

My Selenium Grid is showing an error:

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

but I have specified it perfectly (according to my knowledge)

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. This same code worked perfectly last week but now it doesn't.

like image 942
selva Avatar asked Mar 11 '13 06:03

selva


2 Answers

if you are running the Grid, you need to set up Chromedriver executable in the 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 -D switcher which goes right after the chrome browser setup.

also, if you are running more than one nodes, that path must direct to the chromedriver executable on the concrete computer (node). Thats why I have it as relative path and not as a absolute path...

like image 132
Pavel Janicek Avatar answered Oct 20 '22 01:10

Pavel Janicek


Is this not what you need?

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);
like image 35
markwalker_ Avatar answered Oct 20 '22 00:10

markwalker_