• Register
0 votes
161 views

Problem :

Facing following Selenium Webdriver error
the path to the driver executable must be set by the webdriver.chrome.driver system property
6.9k points

2 Answers

0 votes

Solution :

The path of your Chrome Driver is incorrect. And you must set the property before WebDriver initialisation as follows.

System.setProperty("webdriver.chrome.driver","D:\\List_of_Jar\\chromedriver.exe") ;

WebDriver wd =new ChromeDriver(); 

String baseUrl = "https://www.google.com"; 

wd.get(baseUrl);

36.1k points
0 votes

The path to the driver executable must be set by the webdriver.chrome.driver system properly.

Reason:

If you are experienced this error, then error means that you have not told your system where to find your driver executable. Unlike when using the Firefox WebDriver you need to download a driver executable that is specific for chrome and builds the connections part between your Java Selenium program and the chrome Webbrowser.

Solution:

To fix this problem you have to follow these steps;

  • Download the latest Chrome Driver for your operating system. If you are working with windows then choose “chromedriver_win32.zip”
  • Extract the content of the zip file to any place of your computer, that you will remember later.
  • After replacing the location of the chromedriver.exe with the specific location on your computer. Then add the following code to your Selenium program before creating a new instance of ChromeDriver.
System.setProperty("webdriver.chrome.driver","C:/Your/Path/to/chromedriver.exe");

That is the solution to the above problem.

Code sample:

A whole working code sample can look like this;

import org.openqa.selenium.WebDriver;

import org.openqa.selenium.chrome.ChromeDriver;

/**

 * @author Nils Schuette via frontendtest.org

 */

public class ChromeDriverTest {



            /**

             * @param args

             * @throws InterruptedException

             */

            public static void main(String

              .

            .

}

 

3.9k points

Related questions

0 votes
1 answer 68 views
68 views
Problem : I am trying to learn the Selenium by myself. But now my Sendkeys is not working. Can anybody please help me to fix my issue. My code is as below: WebElement uname = driver.findElement(By.xpath("//*[@id='username']"));      uname.sendKeys("123456"); Below is the error: Exception in ... ip: '192.168.0.103', os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.8.0_161'
asked Feb 14 mphil 2.3k points
0 votes
1 answer 13 views
13 views
Problem: I am very new to Selenium and Java both. I am trying to select and get the dropdown value in a Selenium WebDriver using the Java. The HTML Code is as below: <select class="form_input_select bx-def-font" name="Sex[0]"> <option value="Male">Man</option> < ... it only shows _Others Kindly help me to solve above issue. I am unable to fix above issue after working on it for more than 3 days.
asked Jul 9 Raphael Pacheco 3.2k points
0 votes
1 answer 41 views
41 views
Problem : I am new to Chown. I am still learning it. I tried to set the EACCESS for the npm and then I ran the Chown command in the terminal to change the owner permission but currently i am totally stuck in following "Sudo : /usr/bin/sudo must be owned by uid 0 and have the setuid bit set" I am using ubuntu14.04 LTS. How to fix this error?
asked Feb 27 mphil 2.3k points
0 votes
2 answers 632 views
632 views
Problem : I have the list which has the multiple links under each section. Each section has the same links I need to click the particular link under each section. I have written my code for it but when I execute the code it gives me below error: Exception in thread "main" org.openqa.selenium.StaleElementReferenceException: stale element reference: element is not attached to the page document
asked Jan 18 jwilliam 3.9k points
0 votes
1 answer 15 views
15 views
Problem: I think my Jenkins would ssh in and execute the commands described in a specific job which is running. Currently I want to run my Selenium Webdriver tests but unfortunately it informs me that I have many errors while trying to launch the firefox. I am also ... 45000 ms. Firefox console output: [testng] Xlib: connection to ":0.0" refused by server [testng] Xlib: No protocol specified
asked Jul 11 Raphael Pacheco 3.2k points