gpt4 book ai didi

Python Selenium 异常 AttributeError : "' Service' object has no attribute 'process' "in selenium. webdriver.ie.service.Service

转载 作者:太空狗 更新时间:2023-10-29 18:00:45 35 4
gpt4 key购买 nike

我有一个 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

关于Python Selenium 异常 AttributeError : "' Service' object has no attribute 'process' "in selenium. webdriver.ie.service.Service,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37004635/

35 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com