Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WebDriver cannot be resolved to a type FirefoxDriver cannot be resolved to a type

I found a similar error as mine on stackoverflow and added selenium webdriver jar files to the project using the below method :

right click on project--> goto build path--> configure build path--> click on "Add external jars"--> add selenium jar files from your local machine--> click ok--> now mouseover on WebDriver in your code--> click "import webdriver"--now run your code-->you will get rid of the exception.

However, I am still getting an error. Here's the error :

Exception in thread "main" java.lang.Error: Unresolved compilation problems: WebDriver cannot be resolved to a type FirefoxDriver cannot be resolved to a type

like image 612
Juvelle Mendes Avatar asked Jul 31 '15 06:07

Juvelle Mendes


People also ask

How do you fix WebDriver Cannot be resolved to a type?

right click on project--> goto build path--> configure build path--> click on "Add external jars"--> add selenium jar files from your local machine--> click ok--> now mouseover on WebDriver in your code--> click "import webdriver"--now run your code-->you will get rid of the exception.

Can we write FirefoxDriver driver new FirefoxDriver ()?

Is this correct – FirefoxDriver driver = new FirefoxDriver();? Yes, it is perfectly correct. FirefoxDriver is an implementing class of WebDriver interface and the above statement will launch the Firefox browser.

How do I import a jar file from selenium to eclipse?

Let's go ahead and add Selenium JAR files to our project to fix these errors. - Step 11: Right click on Project Testing. Select Properties > Java build Path. Then click on Libraries tab and click Add External JARs.


4 Answers

even i got the the same error but then i realised that i missed 2 additional JAR files from Selenium 2.53.0.

selenium-java-2.53.0-srcs.jar selenium-java-2.53.0.jar

these are not in the sub library " libs" in selenium 2.53.0 but listed separately in the same folder.

like image 193
ram Avatar answered Sep 22 '22 09:09

ram


This error happens when you use Eclipse as IDE and try to run code that doesn't even compile. Check your Problems view in Eclipse, and fix the compilation errors before executing the application.

like image 25
Anton Angelov Avatar answered Sep 24 '22 09:09

Anton Angelov


I had the same problem but then i came to know that i was missing a jar to add, this jar is not inside the lib folder you can find it immediately outside the lib folder: client-combined-3.0.1-nodeps.jar

like image 34
Atul Chavan Avatar answered Sep 21 '22 09:09

Atul Chavan


Please follow the below steps:

  1. right-click on project--> goto build path--> configure build path
  2. Click on Classpath node which is just below the Modulepath node.
  3. click "Add external jars"--> add selenium jar files from your local machine-->
  4. Click Apply and Close button.
like image 25
user3729220 Avatar answered Sep 22 '22 09:09

user3729220