gpt4 book ai didi

python - Selenium 无法启动 Chromedriver - Ubuntu 16.04,Python 3.6.3

转载 作者:塔克拉玛干 更新时间:2023-11-03 00:37:19 25 4
gpt4 key购买 nike

from selenium import webdriver
browser = webdriver.Chrome()
browser.get('http://www.google.com')

它从来没有真正达到这个并且失败了:

root@server:~# python /root/EmailBot/main.py
Traceback (most recent call last):
File "/root/EmailBot/main.py", line 22, in <module>
browser = webdriver.Chrome()
File "/usr/local/lib/python3.6/dist-packages/selenium/webdriver/chrome/webdriver.py", line 69, in __init__
desired_capabilities=desired_capabilities)
File "/usr/local/lib/python3.6/dist-packages/selenium/webdriver/remote/webdriver.py", line 151, in __init__
self.start_session(desired_capabilities, browser_profile)
File "/usr/local/lib/python3.6/dist-packages/selenium/webdriver/remote/webdriver.py", line 240, in start_session
response = self.execute(Command.NEW_SESSION, parameters)
File "/usr/local/lib/python3.6/dist-packages/selenium/webdriver/remote/webdriver.py", line 308, in execute
self.error_handler.check_response(response)
File "/usr/local/lib/python3.6/dist-packages/selenium/webdriver/remote/errorhandler.py", line 194, in check_response
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 (733a02544d189eeb751fe0d7ddca79a0ee28cce4),platform=Linux 4.4.0-101-generic x86_64)

重要性:

root@server:~# which chromedriver
/usr/local/bin/chromedriver

root@server:~# ll /usr/local/bin/chromedriver
-rwxr-xr-x 1 root root 8950080 Oct 3 14:09 /usr/local/bin/chromedriver*

root@server:~# google-chrome --version
Google Chrome 62.0.3202.94

我已经尝试了我能找到的所有线程,但没有任何解决方案有效。我不确定这是不是因为它是 python 3.6 的问题?

最佳答案

您是否尝试直接在括号内提供 chrome webdriver 路径?相同的代码在我的 Windows 机器上完美运行。我已经设置了环境变量,否则我需要直接提供路径。

关于python - Selenium 无法启动 Chromedriver - Ubuntu 16.04,Python 3.6.3,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47413099/

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