Python Selenium Exception AttributeError:“'服务'对象没有属性'过程'"在selenium.webdriver.ie.service.Service中 [英] Python Selenium Exception AttributeError: "'Service' object has no attribute 'process'" in selenium.webdriver.ie.service.Service

查看:284
本文介绍了Python Selenium Exception AttributeError:“'服务'对象没有属性'过程'"在selenium.webdriver.ie.service.Service中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Selenium Python测试套件.它开始运行,但几分钟后,抛出以下错误:

I have a Selenium Python test suite. It starts to run but after a few mins the following error is thrown:

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)

任何人都可以帮助为什么此错误导致我的测试套件停止运行吗?我该如何解决?

Can anyone help why this error is stopping my test suite from running? How do I solve this?

推荐答案

假设您已经安装了selenium,并假设在控制台的追溯日志中较早的位置,您还得到了类似'chromedriver'可执行文件,需要放在PATH中"的信息脚本,您应该可以做到:

Provided you have installed selenium, and assuming that earlier in the console's traceback log you also got something like "'chromedriver' executable needs to be in PATH" in your script, you should be able to do:

from selenium import webdriver
driver = webdriver.Chrome("/path/to/chromedriver")

这应该告诉您的脚本在哪里可以找到chromedriver.在Mac上,您通常可以使用:/usr/local/bin/chromedriver

This should tell your script where to find chromedriver. On a Mac you can usually use: /usr/local/bin/chromedriver

这篇关于Python Selenium Exception AttributeError:“'服务'对象没有属性'过程'"在selenium.webdriver.ie.service.Service中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆