gpt4 book ai didi

python - WebDriverException : "Process unexpectedly closed with status 255" - selenium/geckodriver/AWS lambda - Python

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

我目前正在 aws lambda(无服务器)上进行网络抓取项目
技术:
python3
Selenium 3.14
geckodriver-V0.29
火狐 80.0 ( headless 模式)
这是我实现的代码(知道我事先为 firefox 和 geckodriver 配置了路径):

from selenium import webdriver
from selenium.webdriver.firefox.options import Options as FirefoxOptions
from selenium.webdriver.firefox.firefox_binary import FirefoxBinary

options = FirefoxOptions()
options.add_argument("--headless")
binary = FirefoxBinary("/tmp/bin/firefox/firefox")

webdriver.Firefox(options=options,executable_path="/tmp/bin/geckodriver", firefox_binary=binary)
这是我得到的错误:
Message: Process unexpectedly closed with status 255
: WebDriverException
Traceback (most recent call last):
File "/var/task/src/lambda_function.py", line 8, in lambda_handler
driver = WebDriverWrapper()
File "/var/task/src/webdriver_wrapper.py", line 116, in __init__
self._driver = webdriver.Firefox(options=options,executable_path="/tmp/bin/geckodriver", firefox_binary=binary)
File "/var/task/lib/selenium/webdriver/firefox/webdriver.py", line 174, in __init__
keep_alive=True)
File "/var/task/lib/selenium/webdriver/remote/webdriver.py", line 157, in __init__
self.start_session(capabilities, browser_profile)
File "/var/task/lib/selenium/webdriver/remote/webdriver.py", line 252, in start_session
response = self.execute(Command.NEW_SESSION, parameters)
File "/var/task/lib/selenium/webdriver/remote/webdriver.py", line 321, in execute
self.error_handler.check_response(response)
File "/var/task/lib/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: Process unexpectedly closed with status 255
我已经搜索了论坛和文章,但没有找到解决方案。有没有人遇到过这种问题,如果可能的话如何解决?

最佳答案

这是关于 Firefox 的问题。
尝试将 Firefox 更新到最新版本。
我认为 Firefox 80.0 与 geckodriver v0.29 不兼容

关于python - WebDriverException : "Process unexpectedly closed with status 255" - selenium/geckodriver/AWS lambda - Python,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67090130/

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