gpt4 book ai didi

python - 消息: unknown error: Chrome failed to start: exited abnormally on AWS Cloud9 with Linux 4. 9.85-38.58.amzn1.x86_64 x86_64

转载 作者:行者123 更新时间:2023-12-01 01:57:13 24 4
gpt4 key购买 nike

在 AWS Cloud9 中工作,我的脚本是:

from bs4 import BeautifulSoup
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
import requests


options = Options()
options.binary_location = '/usr/bin/google-chrome'
driver = webdriver.Chrome(chrome_options=options, executable_path='/home/ec2-user/environment/downloads/chromedriver')
url = 'http://google.com'
driver.get(url)

soup = BeautifulSoup(driver.page_source, 'lxml')

# driver.quit()

print(soup)

但是,当我运行该文件时,运行配置会挂起,直到我使用 ctrl+c 进行键盘中断。回溯返回此:

> Traceback (most recent call last):   File
> "/home/ec2-user/environment/vpy36/lib/python3.6/dist-packages/hubspot-marketplace.py",
> line 9, in <module>
> driver = webdriver.Chrome(chrome_options=options, executable_path='/home/ec2-user/environment/downloads/chromedriver')
> File
> "/home/ec2-user/environment/vpy36/lib/python3.6/dist-packages/selenium/webdriver/chrome/webdriver.py",
> line 75, in __init__
> desired_capabilities=desired_capabilities) File "/home/ec2-user/environment/vpy36/lib/python3.6/dist-packages/selenium/webdriver/remote/webdriver.py",
> line 154, in __init__
> self.start_session(desired_capabilities, browser_profile) File "/home/ec2-user/environment/vpy36/lib/python3.6/dist-packages/selenium/webdriver/remote/webdriver.py",
> line 243, in start_session
> response = self.execute(Command.NEW_SESSION, parameters) File "/home/ec2-user/environment/vpy36/lib/python3.6/dist-packages/selenium/webdriver/remote/webdriver.py",
> line 310, in execute
> response = self.command_executor.execute(driver_command, params) File
> "/home/ec2-user/environment/vpy36/lib/python3.6/dist-packages/selenium/webdriver/remote/remote_connection.py",
> line 466, in execute
> return self._request(command_info[0], url, body=data) File "/home/ec2-user/environment/vpy36/lib/python3.6/dist-packages/selenium/webdriver/remote/remote_connection.py",
> line 490, in _request
> resp = self._conn.getresponse() File "/usr/lib64/python3.6/http/client.py", line 1331, in getresponse
> response.begin() File "/usr/lib64/python3.6/http/client.py", line 297, in begin
> version, status, reason = self._read_status() File "/usr/lib64/python3.6/http/client.py", line 258, in _read_status
> line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1") File "/usr/lib64/python3.6/socket.py", line 586, in readinto
> return self._sock.recv_into(b) KeyboardInterrupt

刚刚花了 4 个小时尝试将 chrome 和 beautifulsoup 安装到 AWS Cloud 9 上。非常困难。

编辑:我只是让它运行,直到它自行停止并返回消息:未知错误:Chrome 无法启动:异常退出

编辑 2:驱动程序信息:chromedriver=2.10.267518,

平台=Linux 4.9.85-38.58.amzn1.x86_64 x86_64

谷歌浏览器66.0.3359.117

最佳答案

此错误消息...

Message: unknown error: Chrome failed to start: exited abnormally

...意味着 ChromeDriver 无法建立新的 Chrome session 。

根据您的问题更新,您的主要问题是您正在使用的二进制文件之间的版本兼容性,如下所示:

  • 您使用的chromedriver=2.10非常古老古老
  • 您正在使用chrome=66.0
  • ChromeDriver v2.38 的发行说明明确提到以下内容:

Supports Chrome v65-67

  • 我们不知道您的Selenium 客户端版本。

因此,ChromeDriver 版本 (v2.10) 和 Chrome 浏览器 版本 (v66.10) 之间存在明显不匹配。 0)

解决方案

  • Selenium升级到当前级别 Version 3.11.0 .
  • ChromeDriver升级到当前的ChromeDriver v2.38级别。
  • Chrome 版本保持在 Chrome v66.x 级别。 (as per ChromeDriver v2.38 release notes)
  • 通过 IDE清理您的项目工作区,并仅使用所需的依赖项重建项目。
  • 使用CCleaner工具可以清除执行测试套件之前和之后的所有操作系统杂务。
  • 如果您的基本网络客户端版本太旧,请通过 Revo Uninstaller 卸载它并安装最新的 GA 和已发布版本的Web 客户端
  • 重新启动系统
  • 执行您的@Test
<小时/>

引用文献

您可以在以下位置找到一些相关讨论:

关于python - 消息: unknown error: Chrome failed to start: exited abnormally on AWS Cloud9 with Linux 4. 9.85-38.58.amzn1.x86_64 x86_64,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50027278/

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