3

I am trying to find any Selenium Tutorials that actually work. Currently looking at this one The project does not compile. It has 6 errors:

1) Firefox Driver cannot be resolved to a type
2) The import org.openqa cannot be resolved.
3) The import org.openqa cannot be resolved.
4) The project was not built since its build path is incomplete. Cannot find the class file for java.lang.Object. Fix the build path then try building this project.
5) The type java.lang.Object cannot be resolved. It is indirectly referenced from required .class files.
6) WebDriver cannot be resolved to a type.

I have the following in my classpath:

byte-buddy-1.7.5.jar, 
client-combined-3.8.1-sources.jar, 
client-combined-3.8.1.jar, 
commons-codec-1.10.jar, 
commons-exec-1.3.jar, 
commons-logging-1.2.jar, 
gson-2.8.2.jar, 
guava-23.0.jar, 
httpclient-4.5.3.jar, 
httpcore-4.4.6.jar

Please help!

Rahul Rathore
  • 658
  • 8
  • 6
Steve Staple
  • 2,983
  • 9
  • 38
  • 73

7 Answers7

6

Try adding the selenium-java dependency to your POM.xml for example:

<dependency>
    <groupId>org.seleniumhq.selenium</groupId>
    <artifactId>selenium-java</artifactId>
    <version>3.141.0</version>
</dependency>

It worked for me!

ADhawan
  • 71
  • 1
  • 3
1

You have to add the selenium jar or maven in the project. You can find selenium jar from here.

These will solve your errors.

Hiten
  • 724
  • 1
  • 8
  • 23
1

Selenium jar has to be added to the project to identify the interface org.openqa.selenium.WebDriver

Selenium download link: http://www.seleniumhq.org/download/

Jignesh
  • 31
  • 10
0

The problem should be in configuring your POM.xml

Check the following,

  1. Did you add all required dependencies in POM file
  2. what version of firefox are you using if latest vesion try downloading 5 versions older

I can help you if more details are provided write to karthickautomationtester@gmail.com

Angel F Syrus
  • 1,984
  • 8
  • 23
  • 43
0

I stumbled upon this, although the question is half a year old, here is what fixed it for me:

At: https://saucelabs.com/resources/articles/getting-started-with-webdriver-selenium-for-java-in-eclipse it is asked to add zip file itself to executable, but unfortunately, at least my eclipse was not able to pick import. So I unzipped it and added all the jar files. There are jar files inside libs as well, which also were needed to be added.

Secondly, although not asked here, but path to exe also needs to be specified as mentioned here: Selenium using Java - The path to the driver executable must be set by the webdriver.gecko.driver system property

More precisely line which needs to be added is:

System.setProperty("webdriver.gecko.driver", path/to/geckodriver.exe");

This worked for me. Hope it helps someone.

user1953366
  • 1,341
  • 2
  • 17
  • 27
0

I was getting Error

" org.openqa.selenium.webdriver can't be resolved. "

The solution is :

Add Selenium Jar files to your Java package or Project. it can be done via Adding External jar files in build path option of package and project .

Angel F Syrus
  • 1,984
  • 8
  • 23
  • 43
Maheep
  • 1
0

During moving and organising files & folders in my machine, i moved all the jars for my project to a another path and i was facing errors in my project, then i added them from the correct path and removed the older jars pointing to the previous location.

But still after sometime, i got all the errors mentioned in the question "The import org.openqa cannot be resolved"

Then i tried removing the jars from the build path and adding them again, it worked for me. The issue was with selenium jars binding.