Getting Error in System.setProperty of ChromeDriver

0 votes

I have written the correct code for setting the property of ChromeDriver and the path is also correct, still, I am getting error. 

My code:

WebDriver driver = new ChromeDriver();
  System.setProperty("webdriver.chrome.driver",
                     "D:\\List_of_Jar\\chromedriver.exe");    
       String Url = "https://www.google.com";driver.get(Url);

I am getting an error as " java.lang.IllegalStateException: The path to the driver executable must be set by the webdriver.chrome.driver system property;"

Apr 19, 2018 in Selenium by Damon Salvatore
• 5,490 points
1,710 views
I am Exactly facing that Same Problem ,Please help me out here..

2 answers to this question.

0 votes

You are launching the browser before setting its system.set property.This is only the error. 

The correct fromat for the code will be:

  System.setProperty("webdriver.chrome.driver","D:\\List_of_Jar\\chromedriver.exe");     
WebDriver driver = new ChromeDriver();  
String Url = "https://www.google.com";driver.get(Url);

 

answered Apr 19, 2018 by Meci Matt
• 9,400 points
0 votes
System.setProperty("webdriver.chrome.driver",
                   "D:\\List_of_Jar\\chromedriver.exe");

put it first and then

WebDriver driver = new ChromeDriver();
String Url = "https://www.google.com";driver.get(Url);

now it will work

answered Jan 8 by anonymous

@User, thats correct. 

System.setProperty("webdriver.chrome.driver","D:\\List_of_Jar\\chromedriver.exe");//here you set system property to webdriver.chrome.driver value and mention the path where it is stored
WebDriver driver = new ChromeDriver();// this is used to create instance of selenium webdriver
driver.get("https://www.google.com");//access the url using the instance of selenium webdriver that you are saying as driver.

Related Questions In Selenium

+1 vote
1 answer
0 votes
1 answer
0 votes
1 answer

Getting a text of elements in div tag having same class name

Basically,there is no need to retrieve element ...READ MORE

answered May 17, 2018 in Selenium by Samarpit
• 5,130 points
3,533 views
0 votes
1 answer

Finding WebDriver element with Class Name in java

The better way to handle this element ...READ MORE

answered Apr 10, 2018 in Selenium by nsv999
• 5,050 points
255 views
0 votes
1 answer
0 votes
1 answer

Geo-location microphone camera pop up

To Allow or Block the notification, access using Selenium and you have to ...READ MORE

answered May 11, 2018 in Selenium by Samarpit
• 5,130 points
621 views
0 votes
1 answer

How to use such xpath to find web elements

It's much simpler to use: #MyDiv123 > div.super or ...READ MORE

answered Jun 14, 2018 in Selenium by Samarpit
• 5,130 points
248 views
0 votes
1 answer