selenium - getting error with chromedriver using RemoteWebdriver -
getting error:
failed configuration: @beforemethod setup org.openqa.selenium.webdriverexception: path driver executable must set webdriver.chrome.driver system property; more information, see http://code.google.com/p/selenium/wiki/chromedriver. latest version can downloaded http://chromedriver.storage.googleapis.com/index.html
my code :
capability = desiredcapabilities.chrome(); capability.setbrowsername("chrome"); capability.setversion("38.0.2125.122 m"); string strchromepath = system.getproperty("user.dir") + "\\webdrivers\\chromedriver.exe"; system.setproperty("webdriver.chrome.driver", strchromepath); capability.setplatform(org.openqa.selenium.platform.any); return new remotewebdriver(new url("http://192.168.1.77:5555/wd/hub"), capability);
on above code chromedriver self not getting invoked.
then tried code:
chromedriverservice chromeservice = new chromedriverservice.builder() .usingdriverexecutable(new file("webdrivers/chromedriver.exe")) .usinganyfreeport().build(); chromeservice.start(); capability = desiredcapabilities.chrome(); capability.setbrowsername("chrome"); capability.setversion("38.0.2125.122 m"); capability.setplatform(org.openqa.selenium.platform.any); return new remotewebdriver(new url("http://192.168.1.77:5555/wd/hub"), capability);
on executing above code executable launched chrome not invoked. throws same error. code working fine firefox. please?
download relevant chrome driver per system(32-bit/64-bit), from here . try setting property of chromedriver first, this:
file file = new file("d:\\chromedriver.exe"); //path chromedriver.exe downloaded system.setproperty("webdriver.chrome.driver", file.getabsolutepath());
then use code:-
desiredcapabilities capability = desiredcapabilities.chrome(); capability.setbrowsername("chrome"); capability.setversion("38.0.2125.122 m"); webdriver driver = new remotewebdriver(new url("http://192.168.1.77:5555/wd/hub"),capability);
if there no need of using "remotewebdriver", can code use below :
file file = new file("d:\\chromedriver.exe"); //path chromedriver.exe downloaded system.setproperty("webdriver.chrome.driver", file.getabsolutepath()); webdriver driver = new chromedriver();
Comments
Post a Comment