Exception in thread main java lang IllegalStateException

0 votes

hi

I am trying selenium first program launching chrome driver. Here is my code I am getting this error once I run it.

package samplefacebook;

import org.openqa.selenium.WebDriver;

import org.openqa.selenium.chrome.ChromeDriver;

public class fbSample {

public static void main(String[] args) {

WebDriver driver = new ChromeDriver();

System.setProperty("webdriver.chrome.driver", "C:\\Users\\prasa\\Downloads\\chromedriver_win32.exe");

driver.get("https://www.facebook.com");

driver.manage().window().maximize(); 

}

}


here is the error i am getting.

Exception in thread "main" java.lang.IllegalStateException: The path to the driver executable must be set by the webdriver.chrome.driver system property; for more information, see https://github.com/SeleniumHQ/selenium/wiki/ChromeDriver. The latest version can be downloaded from http://chromedriver.storage.googleapis.com/index.html

at com.google.common.base.Preconditions.checkState(Preconditions.java:199)

at org.openqa.selenium.remote.service.DriverService.findExecutable(DriverService.java:109)

at org.openqa.selenium.chrome.ChromeDriverService.access$000(ChromeDriverService.java:32)

at org.openqa.selenium.chrome.ChromeDriverService$Builder.findDefaultExecutable(ChromeDriverService.java:137)

at org.openqa.selenium.remote.service.DriverService$Builder.build(DriverService.java:296)

at org.openqa.selenium.chrome.ChromeDriverService.createDefaultService(ChromeDriverService.java:88)

at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:120)

at samplefacebook.fbSample.main(fbSample.java:11)

pls solve this issue.

Thanks

Apr 12, 2020 in Selenium by prasanthi
• 120 points
299 views

1 answer to this question.

0 votes
answered Apr 13, 2020 by Sirajul
• 59,050 points

Related Questions In Selenium

0 votes
0 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,520 points
5,110 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,010 points
5,841 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,890 points
3,603 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 2, 2020 in Selenium by Sri
• 3,010 points
4,346 views
0 votes
1 answer

Exception in thread "main" java.lang.IllegalStateException

Your query is similar to the following ...READ MORE

answered Mar 17, 2020 in Selenium by Sirajul
• 59,050 points
1,524 views
0 votes
1 answer

Exception in thread "main" java.lang.IllegalStateException: The driver executable does not exist: how to solve it?

Your query is similar to https://www.edureka.co/community/46570/illegalstateexception-executable-automation-chromedriver Check it ...READ MORE

answered Nov 6, 2020 in Selenium by Sirajul
• 59,050 points
437 views