1

Getting error:

FAILED CONFIGURATION: @BeforeMethod setUp org.openqa.selenium.WebDriverException: The path to the driver executable must be set by the webdriver.chrome.driver system property; for more information, see http://code.google.com/p/selenium/wiki/ChromeDriver. The latest version can be downloaded from 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 the above code chromedriver it self is not getting invoked.

Then i tried with 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 the executable is launched but chrome is not invoked. It throws the same error. Code is working fine for firefox. Any help please?

Vivek Singh
  • 3,641
  • 2
  • 22
  • 27

2 Answers2

0

Try below :

    WebDriver driver;

    System.setProperty("webdriver.chrome.driver", "properties/chromedriver.exe");

    driver = new ChromeDriver();

    driver.get("www.google.com");

Put chrome driver in properties folder.

Helping Hands
  • 5,292
  • 9
  • 60
  • 127
0

Download the relevant Chrome driver as per your system(32-bit/64-bit), from here . Try setting the property of ChromeDriver first, like this:

File file = new File("D:\\chromedriver.exe"); //path to the chromedriver.exe so downloaded
System.setProperty("webdriver.chrome.driver", file.getAbsolutePath());

Then use this 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 is no need of using "RemoteWebDriver", you can code just use this below :

File file = new File("D:\\chromedriver.exe"); //path to the chromedriver.exe so downloaded
System.setProperty("webdriver.chrome.driver", file.getAbsolutePath());
WebDriver driver = new ChromeDriver();
Subh
  • 4,354
  • 1
  • 13
  • 32
  • Still the same issue. I am first time using remote webdriver, so i guess i am doing it the proper way. The steps i followed are - Start the hub Start the node and then execute the test. – Vivek Singh Nov 19 '14 at 12:31
  • Hope this link helps. http://blog.varunin.com/2011/10/running-tests-on-google-chrome-using.html – Subh Nov 19 '14 at 13:13