0
ExtentReports可用於selenium java網頁驅動程序腳本以生成良好且豐富的HTML測試報告。我正在嘗試在我的使用JPype的selenium python web驅動程序腳本中使用它(JPype是爲了允許python程序完全訪問java類庫)。 我的代碼是這樣在使用Jpype的python webdriver腳本中使用ExtentReports時發生錯誤
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()
,並給它錯誤
Traceback (most recent call last):
File "C:\Users\test\workspace\ExtentReportsProject\ExtentReportsPackage\report.py", line 4, in <module>
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
我使用extentreports-2.41.2.jar和freemarker的-2.3.23.jar。 Python在3.5.1和Java 8更新中使用121
任何人都可以幫忙嗎?
任何解決方案? – nd87tpra