anshooarora / extentreports-java

Community version of Extent API for Java has moved to https://github.com/extent-framework/
http://extentreports.com
Other
528 stars 318 forks source link

Error while using ExtentReports in python webdriver script using Jpype #844

Closed nd87tpra closed 7 years ago

nd87tpra commented 7 years ago

I am trying to use this in my selenium python web-driver script using JPype (JPype is an effort to allow python programs full access to java class libraries). My code is like

from jpype import * classpath = """lib\extentreports-2.41.2.jar;lib\freemarker-2.3.23.jar""" startJVM(getDefaultJVMPath(), "-Djava.class.path=%s" % classpath) ExtentReports = JClass('com.relevantcodes.extentreports.ExtentReports') ExtentTest = JClass('com.relevantcodes.extentreports.ExtentTest') LogStatus = JClass('com.relevantcodes.extentreports.LogStatus') extent = ExtentReports("TestResult\Test_Report.html") test = extent.startTest("My First Test", "Sample description") test.log(LogStatus.INFO, "This step shows usage of log(logStatus, details)") extent.endTest(test) extent.flush() shutdownJVM() And it give error

Traceback (most recent call last): File "C:\Users\test\workspace\ExtentReportsProject\ExtentReportsPackage\report.py", line 4, in ExtentReports = JClass('com.relevantcodes.extentreports.ExtentReports') File "C:\Program Files\Python35\lib\site-packages\jpype1-0.6.2-py3.5-win-amd64.egg\jpype_jclass.py", line 55, in JClass raise _RUNTIMEEXCEPTION.PYEXC("Class %s not found" % name) jpype._jexception.RuntimeExceptionPyRaisable: java.lang.RuntimeException: Class com.relevantcodes.extentreports.ExtentReports not found I am using extentreports-2.41.2.jar and freemarker-2.3.23.jar. Python used in 3.5.1 and Java 8 update 121

Can anyone help with this?

email2vimalraj commented 7 years ago

@nd87tpra : Unfortunately we cannot help much with this since we are not sure how the JPype works. You can seek help from some python community (may be a Stack overflow) who can help you on this.

nd87tpra commented 7 years ago

Ok. Thank you :)