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,980 points
9,721 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,460 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, 2019 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
+1 vote
4 answers
0 votes
2 answers

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,500 points
13,673 views
0 votes
2 answers

Problem while using InternetExplorerDriver in Selenium WebDriver

enable trusted connection  in internet explorer by ...READ MORE

answered Aug 31, 2020 in Selenium by Sri
• 3,190 points
9,142 views
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,910 points
7,221 views
0 votes
2 answers

How to use such xpath to find web elements

xpath are two types. 1) Absolute XPath:    /html/b ...READ MORE

answered Sep 3, 2020 in Selenium by Sri
• 3,190 points
7,874 views
0 votes
1 answer
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP