我有一个Selenium
Python测试套件.它开始运行,但在几分钟后,抛出以下错误:
Exception AttributeError: "'Service' object has no attribute 'process'" in <bound method Service.__del__ of <selenium.webdriver.ie.service.Service object at 0x0000000002610DD8>> ignored
我的测试套件实现是:
import unittest from HTMLTestRunner2 import HTMLTestRunner import os import Regression_TestCase.RegressionProject_TestCase2 # get the directory path to output report file #result_dir = os.getcwd() result_dir = r"E:\test_runners\selenium_regression_test_5_1_1\ClearCore - Regression Test\TestReport" # get all tests from SearchProductTest and HomePageTest class search_tests = unittest.TestLoader().loadTestsFromTestCase(Regression_TestCase.RegressionProject_TestCase2.RegressionProject_TestCase2) # create a test suite combining search_test re_tests = unittest.TestSuite([search_tests]) # open the report file outfile = open(result_dir + "\TestReport.html","w") # configure HTMLTestRunner options runner = HTMLTestRunner.HTMLTestRunner(stream=outfile,title='Test Report',description='Smoke Tests') # run the suite using HTMLTestRunner runner.run(re_tests)
解决方法
如果您已经安装了selenium,并且假设在控制台的追溯记录中,您的脚本中还有一些类似“’chromedriver’可执行文件需要在PATH中”,您应该可以做到:
from selenium import webdriver driver = webdriver.Chrome("/path/to/chromedriver")
这应该告诉你的脚本哪里可以找到chromedriver.在Mac上,通常可以使用:/usr/local / bin / chromedriver