gpt4 book ai didi

python - CircleCi 上的 WebDriverException selenium-python 测试

转载 作者:行者123 更新时间:2023-12-04 16:46:12 27 4
gpt4 key购买 nike

我正在使用 selenium 和 pytest 设置 python 自动化测试,我的目标是在 Circleci 2.0 上运行它。

本地测试正常运行,但是CircleCi服务器出现这个错误,不知道为什么
我试图更新项目模块(但事实并非如此)

    def test_setup(self):
options = webdriver.ChromeOptions()
options.add_argument('-headless')
self.driver = webdriver.Chrome(executable_path=ChromeDriverManager().install(), options=options)
self.driver.maximize_window()
self.driver.get(self.url)
yield
self.driver.quit()

我遇到以下错误:
venv/lib/python3.6/site-packages/selenium/webdriver/chrome/webdriver.py:73: in __init__
self.service.start()
venv/lib/python3.6/site-packages/selenium/webdriver/common/service.py:98: in start
self.assert_process_still_running()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <selenium.webdriver.chrome.service.Service object at 0x7f52e8a66a90>

def assert_process_still_running(self):
return_code = self.process.poll()
if return_code is not None:
raise WebDriverException(
'Service %s unexpectedly exited. Status code was: %s'
> % (self.path, return_code)
)
E selenium.common.exceptions.WebDriverException: Message: Service /home/circleci/.wdm/chromedriver/75.0.3770.8/linux64/chromedriver unexpectedly exited. Status code was: 127

venv/lib/python3.6/site-packages/selenium/webdriver/common/service.py:111: WebDriverException
---------------------------- Captured stdout setup -----------------------------

Checking for linux64 chromedriver:75.0.3770.8 in cache
There is no cached driver. Downloading new one...
Trying to download new driver from http://chromedriver.storage.googleapis.com/75.0.3770.8/chromedriver_linux64.zip
Unpack archive /home/circleci/.wdm/chromedriver/75.0.3770.8/linux64/chromedriver.zip
________ ERROR at setup of TestExperiment.test_search_tutors_from_genf ```


>E selenium.common.exceptions.SessionNotCreatedException: Message: >Unable to find a matching set of capabilities

>venv/lib/python3.6/site->packages/selenium/webdriver/remote/errorhandler.py:242: >SessionNotCreatedException

最佳答案

案例结束,结果是 CircleCi 配置文件存在问题。为了运行这些测试,我被迫在 docker img 上安装 Chrome,方法是向 config.yml 文件添加适当的依赖项。

关于python - CircleCi 上的 WebDriverException selenium-python 测试,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56593195/

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