Python Selenium Exception AttributeError:“’Service’对象在selenium.webdriver.ie.service.Service中没有属性’process’

前端之家收集整理的这篇文章主要介绍了Python Selenium Exception AttributeError:“’Service’对象在selenium.webdriver.ie.service.Service中没有属性’process’前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我有一个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

原文链接:https://www.f2er.com/python/186303.html

猜你在找的Python相关文章