简体   繁体   English

selenium.common.exceptions.WebDriverException:消息:Linux 上的 ChromeDriver Selenium Python 服务 /usr/bin/google-chrome 意外退出

[英]selenium.common.exceptions.WebDriverException: Message: Service /usr/bin/google-chrome unexpectedly exited with ChromeDriver Selenium Python on Linux

from selenium import webdriver

driver = webdriver.Chrome(executable_path=r'/usr/local/bin/google-chrome')
driver.get('https://www.google.co.in')
print("Page Title is : %s" %driver.title)
driver.quit()

I receive this error:我收到此错误:

 File "test.py", line 5, in <module>
    driver = webdriver.Chrome(executable_path=r'/usr/bin/google-chrome')
  File "/usr/local/python3/lib/python3.6/site-packages/selenium/webdriver/chrome/webdriver.py", line 73, in __init__
    self.service.start()
  File "/usr/local/python3/lib/python3.6/site-packages/selenium/webdriver/common/service.py", line 98, in start
    self.assert_process_still_running()
  File "/usr/local/python3/lib/python3.6/site-packages/selenium/webdriver/common/service.py", line 111, in assert_process_still_running
    % (self.path, return_code)
selenium.common.exceptions.WebDriverException: Message: Service /usr/bin/google-chrome unexpectedly exited. Status code was: 1

I tried other solutions from the internet but every solution I tried I received a new error.我尝试了互联网上的其他解决方案,但我尝试的每个解决方案都收到了一个新错误。 I just want to get page source using python selenium and chrome driver, I don't know why none solutions working for me, any help?我只想使用 python selenium 和 chrome 驱动程序获取页面源,我不知道为什么没有解决方案对我有用,有什么帮助吗?

Im do this in client-server, in my local im using windows and its work good, however its different code...我在客户端 - 服务器中执行此操作,在我的本地即时消息中使用 Windows 并且它的工作良好,但是它的代码不同......

This error message...这个错误信息...

selenium.common.exceptions.WebDriverException: Message: Service /usr/bin/google-chrome unexpectedly exited. Status code was: 1

...implies that the ChromeDriver was unable to initiate/spawn a new Browsing Context ie Chrome Browser session. ...暗示ChromeDriver无法启动/生成新的浏览上下文,Chrome 浏览器会话。

Seems you were pretty close.看来你已经很接近了。 Through the Key executable_path instead of the absolute path of google-chrome binary you need to pass the absolute path of the ChromeDriver as the Value .通过Key executable_path而不是google-chrome二进制executable_path绝对路径,您需要将ChromeDriver绝对路径作为Value传递。 So effectively, you need to replace the line of code:如此有效,您需要替换以下代码行:

driver = webdriver.Chrome(executable_path=r'/usr/local/bin/google-chrome')

With:和:

driver = webdriver.Chrome(executable_path='/path/to/chromedriver')

Install this packages and try again :安装此软件包并重试:

apt-get install -y libglib2.0-0=2.50.3-2 \
    libnss3=2:3.26.2-1.1+deb9u1 \
    libgconf-2-4=3.2.6-4+b1 \
    libfontconfig1=2.11.0-6.7+b1

or you can install chromium-browser:或者您可以安装铬浏览器:

sudo apt-get install -y chromium-browser

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 WebDriverException:消息:服务 /usr/bin/google-chrome 意外退出。 状态代码是:-11 使用 ChromeDriver Chrome 通过 Selenium Python - WebDriverException: Message: Service /usr/bin/google-chrome unexpectedly exited. Status code was: -11 with ChromeDriver Chrome through Selenium Python selenium.common.exceptions.WebDriverException:消息:服务 chromedriver 意外退出 - selenium.common.exceptions.WebDriverException: Message: Service chromedriver unexpectedly exited Docker Selenium:selenium.common.exceptions.WebDriverException:消息:服务chromedriver意外退出。 状态码为:127 - Docker Selenium: selenium.common.exceptions.WebDriverException: Message: Service chromedriver unexpectedly exited. Status code was: 127 selenium.common.exceptions.WebDriverException:消息:服务 chromedriver 意外退出。 状态码是:1 - selenium.common.exceptions.WebDriverException: Message: Service chromedriver unexpectedly exited. Status code was: 1 selenium.common.exceptions.WebDriverException: 消息:无法通过 Selenium Python 使用 ChromeDriver Chrome 连接到服务错误 - selenium.common.exceptions.WebDriverException: Message: Can not connect to the Service error using ChromeDriver Chrome through Selenium Python selenium.common.exceptions.WebDriverException:消息:未知错误:Chrome无法启动:使用ChromeDriver Chrome和Selenium异常退出 - selenium.common.exceptions.WebDriverException: Message: unknown error: Chrome failed to start: exited abnormally with ChromeDriver Chrome and Selenium selenium.common.exceptions.WebDriverException:消息:chromedriver 意外退出。 状态码为:255 使用 Dockerfile 时 - selenium.common.exceptions.WebDriverException: Message: chromedriver unexpectedly exited. Status code was: 255 When using Dockerfile webDriverException“selenium.common.exceptions.WebDriverException:消息:Service./webdrivers/geckodriver 意外退出。状态代码为:1” - webDriverException "selenium.common.exceptions.WebDriverException: Message: Service ./webdrivers/geckodriver unexpectedly exited. Status code was: 1" selenium.common.exceptions.WebDriverException:消息:服务意外退出。 状态码为:3221225595 - selenium.common.exceptions.WebDriverException: Message: Service unexpectedly exited. Status code was: 3221225595 selenium.common.exceptions.WebDriverException:消息:服务geckodriver意外退出。 状态代码为:-11-如何解决? - selenium.common.exceptions.WebDriverException: Message: Service geckodriver unexpectedly exited. Status code was: -11 - How to fix?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM