What should I do in case Webdriver cannot be resolved to a type java?

10.6K    Asked by Anil Mer in Java , Asked on May 10, 2022

"The import org.openqa cannot be resolved".

"WebDriver cannot be resolved to a type".

"ChromeDriver cannot be resolved to a type".

This type of error occurred when writing a TestNG program. Before the TestNg installation, the selenium program is executing properly. It doesn't give such a type of error. This type of error occurs only after TestNG installation, I had to uninstall TestNG and then again install TestNG 2 times also. But I'm still facing the same problem.

Answered by Anisha Dalal

This error - cannot be resolved to a type java means that Eclipse IDE cannot find the required classes in your class path. Probably you have accidentally removed WebDriver jars or selenium jars when adding TestNg. If you use Maven check also that you are using the proper scope of dependencies. If your code resides under the test folder and your dependencies do not have test scope, then you might get issues with class visibility.

Your Answer


Parent Categories