Selenium Grid showing WebDriverException error
Asked Answered
M

2

5

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.

Morocco answered 11/3, 2013 at 6:44 Comment(5)
try putting System.setProperty("webdriver.chrome.driver", "D:\\testing\\zip file\\chromedriver_win_26.0.1383.0\\chromedriver.exe") before capability= DesiredCapabilities.chrome();Weanling
@Soft The code you are using is correct. Can you double check if the chromedriver.exe is present in the same path given in this code?Srinagar
hi Lokesh i tried that but still it not working ...Morocco
@Srinagar the Chromedriver.exe is present only ..Morocco
If you are using a grid, should not you be using new RemoteWebDriver("ipaddresstoyournode", capabilities);Gerard
H
10

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...

Houdini answered 11/3, 2013 at 8:48 Comment(4)
hi Pavel Janicek Thank you very much it working now .. if possible can you guide me how to do the Picture upload task through grid .. im using AutoIt for uploading for in Grid it fails .. Can you help me on this ..Morocco
Hi Soft, in my scripts I am not actually uploading anything. Try to search here "how to upload image selenium grid" - there should be already solved issues for that. If not, simply ask another question - thats what StackOverflow is there for :)Houdini
So I am seeing 2 different things here. Some are providing chrome driver path in the code and others are setting it up on the node itself when you start the node service. Do you need to do both? or just one of them will work?Gerard
In case of selenium grid you need it to setup only on Node levelHoudini
D
1

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);
Deon answered 11/3, 2013 at 8:29 Comment(1)
hi marksweb i tried but still getting that same issues .. and particularly im getting that on an line where i use this code driver = new RemoteWebDriver(new URL("localhost:4444/wd/hub"), capability);Morocco

© 2022 - 2024 — McMap. All rights reserved.