Solved

Eclipse Java import and method not resolved

Posted on 2017-02-25
4
135 Views
Last Modified: 2017-03-07
Hello,
I have a couple of "unresolved" issues.  I tried fixing my problems using the options within Eclipse, but nothing works.
I know that I have in import/install the org.opeqa.selenium API, yet can't find the API at org.openqa, and I know that my Selenium API needs to be installed as well.  I thought I did have it via Selinity - Selenium plugin, but I guess not.
These are my issues;
import org.openqa...cannot be resolved
FirefoxDriver cannot be resolved to a type
Method undined for WebDriver

This is the code;
import org.junit.Test;

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;

public class MyFirstWebdriverTest<WebDriver> {
      @Test
      public void checkSeleniumHQinFirefox(){
        WebDriver driver = new FirefoxDriver();
        driver.get("http://seleniumhq.org");
        driver.quit();
      }
}
0
Comment
Question by:chima
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 23

Expert Comment

by:Siva Prasanna Kumar
ID: 42024564
Hi Chima,

You need to download the selenium web driver jars from here and add this to your project build path..

http://selenium-release.storage.googleapis.com/3.1/selenium-java-3.1.0.zip

Download the above link and then you find selenium jar which needs to be added to build path.
0
 

Author Comment

by:chima
ID: 42025922
Siva, I downloaded the Selenium zip file, extracted the file/folder, and added the path to the System Environmental variable path;
C:\Selenium-java-3.1.0\lib     Yet this did not solve my "resolve" issue.  I'll search for the solution, yet I thought I'd enter this comment here/now.
0
 
LVL 23

Accepted Solution

by:
Siva Prasanna Kumar earned 500 total points
ID: 42025999
Chima, you are using eclipse right?

You need to add the jar files to the build path of the project, no need to add them to the path.

You can refer to this tutorial:

http://www.wikihow.com/Add-JARs-to-Project-Build-Paths-in-Eclipse-(Java)

Method 2 [Add external jars] as that's the easiest one, but method 1 ensures all dependencies are in one project.
0
 

Author Closing Comment

by:chima
ID: 42038233
Thanks
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Learn by example how to specify CSS selectors for Selenium WebDriver test automation software.
Computer science students often experience many of the same frustrations when going through their engineering courses. This article presents seven tips I found useful when completing a bachelors and masters degree in computing which I believe may he…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.

751 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question