TestNG error - Cannot find class in classpath

0 votes
I'm pretty new to TestNG framework. I downloaded TestNG. After that, I created a new Java Project named as MyProject and a new TestNG class file "NewTest". I did write a small piece of Code with @Test annotation to launch Firefox browser and navigate to Google. I tried searching the web for possible solutions to sort this issue but I am not able to find the low level steps on how this can be corrected. Please help.
Mar 23, 2018 in Selenium by nitinrawat895
• 11,380 points
40,017 views
Im also facing this issue

2 answers to this question.

0 votes

The issue is because the project directory where the package is present, over there TestNG is not present. Make sure to the follow the hierarchy wrt src folder being inside project directory, and .java files and .class files will be automatically created as per your structure.

Hope this helps!

Check out the Selenium Testing Course and learn more about it.

answered Mar 24, 2018 by nsv999
• 5,500 points
+1 vote

The above link didn't work it means you need a higher version of TestNG for the eclipse. Before that check TestNG is installed or not in order to know that press CTRL+N in the wizard you can see TestNG class file name.

If it is not displaying then try installing TestNG In Eclipse IDE Via Offline Jar Files:

1)Download the latest TestNG Jar files from the link TestNg Jars ("https://github.com/cbeust/testng-eclipse")
2)Download TestNG 6.11, Clicking on the link will download the “site_assembly.zip” file for the TestNG version 6.11. This file contains two folders named as “features” and “plugins“.Go to the eclipse installation directory and look for the “dropins” folder there.
3)Create a folder inside the dropins folder and name it as “testng-eclipse-6.11“
4)Extract the “site_assembly.zip” file and copy its contents to the newly created “testng-eclipse-6.11” directory.
5)Restart Eclipse

OR

Go click on Help> Install new Software> Under Available software> Work with textbox paste this "2019-06 - http://download.eclipse.org/releases/2019-06" and then click on ADD. You will now see the files like TestNG and a lot many others. Select TestNG click on Next> Next> Accept the condtions> Finish. It will restart the eclipse. Inorder to know the installation is successful Press CTRL+N.

answered Feb 12, 2020 by Rashmi Reddy PR

Related Questions In Selenium

0 votes
1 answer
0 votes
1 answer

How to eliminate this error”Cannot instantiate the type Select in selenium webdriver”

Try below code. Select sc = new Select(driver.findElement(By.xpath("your ...READ MORE

answered May 18, 2018 in Selenium by Samarpit
• 5,910 points
9,585 views
0 votes
1 answer

How to avoid Compound Class name error in Page Object?

Use a CSS selector instead: .country.name CSS selector is ...READ MORE

answered Jul 31, 2018 in Selenium by Meci Matt
• 9,460 points
996 views
0 votes
1 answer

Getting error while running a XML file in TestNG

Hello @Sradha, The synatx of using test is ...READ MORE

answered Dec 26, 2018 in Selenium by Rashmi
15,564 views
0 votes
1 answer
+1 vote
1 answer

getting error in testng java.lang.NoClassDefFoundError: com/google/common/collect/ImmutableMap

A NoClassDefFoundError is thrown when the JRE can't find ...READ MORE

answered Jun 4, 2020 in Selenium by Ramesh
• 140 points
27,297 views
0 votes
2 answers

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,500 points
12,718 views
0 votes
2 answers

Problem while using InternetExplorerDriver in Selenium WebDriver

enable trusted connection  in internet explorer by ...READ MORE

answered Aug 31, 2020 in Selenium by Sri
• 3,190 points
8,612 views
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,910 points
6,685 views
0 votes
2 answers

How to use such xpath to find web elements

xpath are two types. 1) Absolute XPath:    /html/b ...READ MORE

answered Sep 3, 2020 in Selenium by Sri
• 3,190 points
7,554 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP