我尝试了一个简单的硒程序来生成HTML报告。测试用例运行完美,但未生成HTML报告。
from selenium import webdriver
import unittest
import HtmlTestRunner
# Keyword
url = 'https://amazon.in'
path = 'C:/bin/chromedriver.exe'
class amazonTest(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.driver = webdriver.Chrome(executable_path=path)
cls.driver.maximize_window()
def test_openWebsite(self):
self.driver.get(url)
print(self.driver.title)
@classmethod
def tearDownClass(cls):
cls.driver.close()
cls.driver.quit()
if __name__ == '__main__':
unittest.main(testRunner=HtmlTestRunner.HTMLTestRunner(output="C:/Users/tester/Desktop/PYTHON/sampleReport"))