Getting Cannot find class in classpath mainDriverScript error | Selenium Forum
B
bahri.vinayak Posted on 17/04/2019

Hi Ashish, 

Hope you are doing good. 
Program was working absolutely fine till yesterday and all of a sudden I started getting below error. I have done the following but nothing has helped

1) Checked testng.xml file. <class name="main.DriverScript" ></class>  is correct.  main is the package name and DriverScript is the class name. 

2) Project>clean 

3) right click on eclipse project > TestNG > Convert to TestNG and replacing the existing testng.xml

4) Tried running the project without TestNG, as I have build hybrid framework and really dont need testng.

Please let me know incase you need more information. Appreciate your help. 

Below is the error msg

[RemoteTestNG] detected TestNG version 6.12.0
org.testng.TestNGException:
Cannot find class in classpath: main.DriverScript
at org.testng.xml.XmlClass.loadClass(XmlClass.java:81)
at org.testng.xml.XmlClass.init(XmlClass.java:73)
at org.testng.xml.XmlClass.<init>(XmlClass.java:59)
at org.testng.xml.TestNGContentHandler.startElement(TestNGContentHandler.java:575)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.AbstractXMLDocumentParser.emptyElement(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.emptyElement(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl.parse(Unknown Source)
at javax.xml.parsers.SAXParser.parse(Unknown Source)
at org.testng.xml.XMLParser.parse(XMLParser.java:39)
at org.testng.xml.SuiteXmlParser.parse(SuiteXmlParser.java:16)
at org.testng.xml.SuiteXmlParser.parse(SuiteXmlParser.java:9)
at org.testng.xml.Parser.parse(Parser.java:170)
at org.testng.TestNG.initializeSuitesAndJarFile(TestNG.java:298)
at org.testng.TestNG.initializeEverything(TestNG.java:1107)
at org.testng.remote.support.RemoteTestNG6_12.initialize(RemoteTestNG6_12.java:22)
at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:97)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:251)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:77)


A
Ashish Thakur Replied on 17/04/2019

The compiler is not able to find class in classpath: main.DriverScript.

 

Additionally, you cannot run the test without TestNG.