0

I am using all latest versions as in below but still see the issue said in above. Can someone help with it.

  • Eclipse IDE Version: 2019-12 (4.14.0);
  • WebDriver (Java) - 3.141.59
  • ChromeDriver 79.0.3945.36

Here is my code:

package AutomationFrameWork;

import org.openqa.selenium.*;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
org.openqa.selenium.chrome.*;

public class FirstTestCase {

    public static void main(String[] args) {
        // TODO Auto-generated method stub



        WebDriver driver = new ChromeDriver();  
        System.setProperty("webdriver.chrome.driver", "C:\\Users\\xxxx.000\\Desktop\\Selenium\\chromedriver_win32\\chromedriver.exe");
         driver.get("www.google.ca");

         System.out.println("Successfully opened the website");


         driver.quit();


    }

} 

Error:

Exception in thread "main" java.lang.Error: Unresolved compilation problems: WebDriver cannot be resolved to a type ChromeDriver cannot be resolved to a type at AutomationFrameWork.FirstTestCase.main(FirstTestCase.java:15)

frianH
  • 7,295
  • 6
  • 20
  • 45
ShanM
  • 1
  • 1

2 Answers2

0

System.setProperty() should be prior to driver intialization. Also check version of chrome browser and chrome driver are in sync.

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
Mounika
  • 1
  • 2
0

You need to give like this .Also better to put in a folder than putting on the desktop.

WebDriver driver;
System.setProperty("webdriver.chrome.driver",System.getProperty("user.dir")+"\\Jar_files\\chromedriver.exe");
driver = new ChromeDriver();
undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
Sameera De Silva
  • 1,722
  • 1
  • 22
  • 41