消息:未知错误:Chrome无法启动:在具有Linux 4.9.85-38.58.amzn1.x86_64 x86_64的AWS Cloud9上异常退出 [英] Message: unknown error: Chrome failed to start: exited abnormally on AWS Cloud9 with Linux 4.9.85-38.58.amzn1.x86_64 x86_64

查看:105
本文介绍了消息:未知错误:Chrome无法启动:在具有Linux 4.9.85-38.58.amzn1.x86_64 x86_64的AWS Cloud9上异常退出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

Working in AWS Cloud9, my script is:

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键盘中断为止.追溯返回此:

However, when I run the file, the run configuration hangs until I keyboard interrupt with ctrl+c. Traceback returns this:

> 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上.非常困难.

Just spent the last 4 hours trying to install chrome and beautifulsoup onto AWS Cloud 9. Very difficult.

我只是让它运行,直到它自身停止并返回Message: unknown error: Chrome failed to start: exited abnormally

I just let it run until it stopped by itself and returned Message: unknown error: Chrome failed to start: exited abnormally

驱动程序信息:chromedriver = 2.10.267518,

Edit 2: Driver info: chromedriver=2.10.267518,

platform = Linux 4.9.85-38.58.amzn1.x86_64 x86_64

platform=Linux 4.9.85-38.58.amzn1.x86_64 x86_64

Google Chrome 66.0.3359.117

Google Chrome 66.0.3359.117

推荐答案

此错误消息...

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

...表示 ChromeDriver 无法建立新的 Chrome 会话.

...implies that the ChromeDriver was unable to establish a new Chrome session.

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

As per your question update your main issue is the version compatibility between the binaries you are using as follows :

  • You are using chromedriver=2.10 which pretty old and ancient
  • You are using chrome=66.0
  • Release Notes of ChromeDriver v2.38 clearly mentions the following :

支持 Chrome v65-67

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