What Is To Be Done If The Webdriver Can’t Be Resolved To A Type Java?

163    Asked by Dhruvtiwari in Java , Asked on Aug 2, 2023
The import org.openqa cannot be resolved”.
“WebDriver cannot be resolved to a type”.
“ChromeDriver cannot be resolved to a type”

I received the above-mentioned error while writing a TestNG program. Prior to the TestNg installation, the selenium program was working well. It does not render any kind of error. The error happens post TestNG installation. I needed to uninstall TestNG and reinstall it twice. However, the problem still persists. 

Answered by Elayne Balding

The error message implies that Eclipse IDE can’t detect the necessary classes existing in the class path. Possibly, you may have mistakenly erased WebDriver jars or selenium jrs while including TestNg. In case you deploy maven, you must check that you are utilizing the right scope of dependencies. In case the code exists under the test folder and the dependencies do not include test scope, then you can face problems regarding class visibility.

You can try cleaning the project by navigating to the below-mentioned menu

      Project > Clean

However, if it does not work, then try to erase the jars from the build path and reinstall them. The Java Online Certification Training offered at JanBask Training provides experience like offline classes to help candidates master the concepts of Java in a better way to face the tough job market scenario. The course guarantees job success and lets you qualify the certification exam through intensive, and expert-led virtual sessions and hands-on practical assignments. The course will teach you to create and configure the Java codes to help you gather, extract, and examine the data relevant to the customer base. Furthermore, JanBask Training helps you get job-ready and face the tough competitive market with confidence.

Your Answer


Parent Categories