0

Here is my code for selenium webDriver

package com.pack;

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

public class GoogleSearchTest {
public static void main(String...args) {

        WebDriver driver  = new FirefoxDriver();
        driver.navigate().to("http://google.com");
        String appTitle = driver.getTitle();
        System.out.println("Application title is :: "+appTitle);
        driver.quit();

}
}

Below is the Error I am getting:

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

    at com.pack.GoogleSearchTest.main(GoogleSearchTest.java:9)

I need to understand why I am getting that error.

Gautam Savaliya
  • 1,209
  • 2
  • 17
  • 28
  • Possible duplicate of [WebDriver cannot be resolved to a type FirefoxDriver cannot be resolved to a type](http://stackoverflow.com/questions/31739392/webdriver-cannot-be-resolved-to-a-type-firefoxdriver-cannot-be-resolved-to-a-typ) – Leigh May 07 '16 at 21:53
  • 1
    which dependencies did you include with the project and what kind of project it is, e.g. maven,...) – Kiril S. May 08 '16 at 15:52
  • actually i was trying to run a simple program in eclipse IDE. for that purpose i have created a com.pack package with class GoogleSearchTest but on executing this i am receiving the above error. i am unable to rectify that error. please let me know if you wanted other information from my side. – Ghulam Mohammad May 09 '16 at 10:50

1 Answers1

0

Looks like you are trying to run the code that is already having compilation issues. You should be seeing a tab called "Problems", where it shows all/ any possible errors and warnings. Do you see anything in that tab? If so it will walk through the steps that you need to follow to overcome the issue.

The other option is to download a fresh copy of eclipse IDE and configure your selenium. Let me know which one worked for you.

Khaja Mohammed
  • 747
  • 4
  • 16