I'm Getting error as soon as I Initialize driver = new ChromeDriver();

+2 votes
below is my code.

package com.salesforce.pageobject;

import org.openqa.selenium.WebDriver;

import org.openqa.selenium.chrome.ChromeDriver;

import org.testng.annotations.BeforeClass;

public class BaseClass {

// public String url =

// public String username =

// public String password =

public static WebDriver driver;


public void setup()



    driver = new ChromeDriver();


I'm getting error at very first line (package com.salesforce.pageobject;) and driver = new ChromeDriver();

when I initiaize WebDriver means when I write driver = new ChromeDriver();

Error that I get at package com.salesforce.pageobject; is below

(The type org.openqa.selenium.remote.RemoteWebDriver cannot be resolved. It is indirectly referenced from required .class files)

for driver = new ChromeDriver(); it's Type mismatch: cannot convert from ChromeDriver to WebDriver
Aug 22, 2019 in Selenium by Prajwal Wakekar

2 answers to this question.

+4 votes
Hi Prajwal, this type of error occurs when you have added the external jars in the ModulePath. To resolve this issue, you can remove the external jars from the node "Modulepath". Select the node "Classpath" then add the external jars. Review that all the jars are under the node "Classpath"
answered Oct 10, 2019 by Abha
• 27,920 points
Have you tried changing the compiler level in eclipse as suggested by another answer?
yes...i tried that too

Above error shows up when you do not have JRE or JDK not added to your build path. This is the well-known bug with Eclipse.

The possible solution is

  1. Close the project and reopen it.
  2. Clean the project (It will rebuild the build path hence reconfiguring with the JDK libraries  OR
  3. Delete and Re-import the project and if necessary do the above steps again
Thanks a lot Abha....its working :)
I Searched all over the internet for this issue and finally It got resolved when I removed it from module path and added under class path..Thanks a ton
+1 vote
If still getting the error "WebDriver cannot be resolved", after adding jar files to class path, go to Project -> Properties -> Java Compiler -> Change compiler level to 1.7 or so in Eclipse. This will resolve the errors.
answered Apr 8 by anonymous
Thanks heaps...It worked..hurray....was scratching my head off since last night...Thanks once again :)

Related Questions In Selenium

0 votes
1 answer
0 votes
2 answers

Getting Error in System.setProperty of ChromeDriver

System.setProperty("webdriver.chrome.driver", ...READ MORE

answered Jan 8, 2019 in Selenium by anonymous
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

Finding WebDriver element with Class Name in java

The better way to handle this element ...READ MORE

answered Apr 10, 2018 in Selenium by nsv999
• 5,510 points
0 votes
1 answer
0 votes
1 answer

Geo-location microphone camera pop up

To Allow or Block the notification, access using Selenium and you have to ...READ MORE

answered May 11, 2018 in Selenium by Samarpit
• 5,870 points
0 votes
1 answer

How to use such xpath to find web elements

It's much simpler to use: #MyDiv123 > div.super or ...READ MORE

answered Jun 14, 2018 in Selenium by Samarpit
• 5,870 points
0 votes
1 answer

i am not able to perform this method in selenium driver.get("google")

Hi Sachin, are you getting any errors ...READ MORE

answered May 15, 2019 in Selenium by Abha
• 27,920 points