Selenium fails to start Chromedriver in CentOS(Selenium 无法在 CentOS 中启动 Chromedriver)
问题描述
我尝试用 Selenium 启动 Chromedriver
从 selenium 导入 webdriver驱动程序 = webdriver.Chrome()driver.get("http://www.google.com/")打印(驱动程序.标题)
和下面的错误消息:
raise exception_class(message, screen, stacktrace)selenium.common.exceptions.WebDriverException:消息:未知错误:Chrome 无法启动:异常退出(驱动信息:chromedriver=2.33.506092,platform=Linux 3.10.0-693.5.2.el7.x86_64 x86_64)
我正在使用这些:
[root@jdu4e00u53f7 工作区]# ll/usr/local/bin/chromedriverlrwxrwxrwx 1 root root 17 11 月 14 00:31/usr/local/bin/chromedriver ->/opt/chromedriver
- CentOS 7.3
- Python(3.6.2)
- 硒 (3.7.0)
- 谷歌浏览器 (62.0.3202.89)
- chromedriver(2.9)/我改成chromedriver=2.33.506092
- Xvfb
ps,我也试过了
driver = webdriver.Chrome('/usr/local/bin/chromedriver')
,不行……
test.py输出
参考:Selenium 无法启动 Chromedriver
- 在我的服务器上在后台启动 Xvfb:
Xvfb :0 -ac -screen 0 1024x768x24 &
也不起作用
ref:未知错误:Chrome 失败启动:异常退出(驱动信息:chromedriver=2.9
从您提到的配置中可以明显看出您使用的是 Selenium v3.7.0
, Google Chrome 62.0
以及不兼容的 chromedriver v2.9
.因此,我们看到了错误 WebDriverException: Message: unknown error: Chrome failed to start: exited异常
ChromeDriver v2.33
的发行说明明确提到Supports Chrome v60-62
解决方案:
从 chromedriver v2.33
="nofollow noreferrer">this link
并执行你的测试用例.
更新:
试试下面的代码块:
从 selenium 导入 webdriverdriver = webdriver.Chrome(executable_path='/usr/local/bin/chromedriver')driver.get('https://www.google.co.in')print("页面标题是:%s" %driver.title)driver.quit()
<块引用>
或
从 selenium 导入 webdriverdriver = webdriver.Chrome(executable_path='/opt/chromedriver')driver.get('https://www.google.co.in')print("页面标题是:%s" %driver.title)driver.quit()
I try to start Chromedriver with Selenium
from selenium import webdriver
driver = webdriver.Chrome()
driver.get("http://www.google.com/")
print(driver.title)
and error msg below:
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: unknown error: Chrome failed to start: exited abnormally
(Driver info: chromedriver=2.33.506092,platform=Linux 3.10.0-693.5.2.el7.x86_64 x86_64)
I am using these:
[root@jdu4e00u53f7 workspace]# ll /usr/local/bin/chromedriver
lrwxrwxrwx 1 root root 17 11月 14 00:31 /usr/local/bin/chromedriver -> /opt/chromedriver
- CentOS 7.3
- Python(3.6.2)
- selenium (3.7.0)
- Google Chrome (62.0.3202.89)
- chromedriver(2.9)/ I changed to chromedriver=2.33.506092
- Xvfb
ps, I also tried
driver = webdriver.Chrome('/usr/local/bin/chromedriver')
,it not work...
test.py output
ref :Selenium fails to start Chromedriver
- On my server start Xvfb in the background:
Xvfb :0 -ac -screen 0 1024x768x24 &
and also not work
ref:unknown error: Chrome failed to start: exited abnormally (Driver info: chromedriver=2.9
It is much evident from your mentioned configuration that you are using Selenium v3.7.0
, Google Chrome 62.0
along with chromedriver v2.9
which is not compatible. Hence we are seeing the error WebDriverException: Message: unknown error: Chrome failed to start: exited abnormally
The Release Notes of
ChromeDriver v2.33
clearly mentionsSupports Chrome v60-62
Solution:
Download the latest chromedriver v2.33
from this link
and execute your testcase.
Update :
Try the following code block :
from selenium import webdriver
driver = webdriver.Chrome(executable_path='/usr/local/bin/chromedriver')
driver.get('https://www.google.co.in')
print("Page Title is : %s" %driver.title)
driver.quit()
OR
from selenium import webdriver
driver = webdriver.Chrome(executable_path='/opt/chromedriver')
driver.get('https://www.google.co.in')
print("Page Title is : %s" %driver.title)
driver.quit()
这篇关于Selenium 无法在 CentOS 中启动 Chromedriver的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:Selenium 无法在 CentOS 中启动 Chromedriver
基础教程推荐
- 如何在海运重新绘制中自定义标题和y标签 2022-01-01
- 使用PyInstaller后在Windows中打开可执行文件时出错 2022-01-01
- 何时使用 os.name、sys.platform 或 platform.system? 2022-01-01
- 用于分类数据的跳跃记号标签 2022-01-01
- 线程时出现 msgbox 错误,GUI 块 2022-01-01
- 筛选NumPy数组 2022-01-01
- 如何让 python 脚本监听来自另一个脚本的输入 2022-01-01
- 在 Python 中,如果我在一个“with"中返回.块,文件还会关闭吗? 2022-01-01
- Python kivy 入口点 inflateRest2 无法定位 libpng16-16.dll 2022-01-01
- Dask.array.套用_沿_轴:由于额外的元素([1]),使用dask.array的每一行作为另一个函数的输入失败 2022-01-01