1. <i id='kYahm'><tr id='kYahm'><dt id='kYahm'><q id='kYahm'><span id='kYahm'><b id='kYahm'><form id='kYahm'><ins id='kYahm'></ins><ul id='kYahm'></ul><sub id='kYahm'></sub></form><legend id='kYahm'></legend><bdo id='kYahm'><pre id='kYahm'><center id='kYahm'></center></pre></bdo></b><th id='kYahm'></th></span></q></dt></tr></i><div id='kYahm'><tfoot id='kYahm'></tfoot><dl id='kYahm'><fieldset id='kYahm'></fieldset></dl></div>
    2. <tfoot id='kYahm'></tfoot>
        <bdo id='kYahm'></bdo><ul id='kYahm'></ul>
    3. <small id='kYahm'></small><noframes id='kYahm'>

      <legend id='kYahm'><style id='kYahm'><dir id='kYahm'><q id='kYahm'></q></dir></style></legend>

        WebDriverException:消息:未知错误:Chrome 无法启动:通过 VPS 上的 Python 使用 C

        WebDriverException: Message: unknown error: Chrome failed to start: exited abnormally with ChromeDriver Chrome and Selenium through Python on VPS(WebDriverException:消息:未知错误:Chrome 无法启动:通过 VPS 上的 Python 使用 ChromeDriver Chrome

        <legend id='45sm0'><style id='45sm0'><dir id='45sm0'><q id='45sm0'></q></dir></style></legend>
        1. <small id='45sm0'></small><noframes id='45sm0'>

            <tbody id='45sm0'></tbody>

              <i id='45sm0'><tr id='45sm0'><dt id='45sm0'><q id='45sm0'><span id='45sm0'><b id='45sm0'><form id='45sm0'><ins id='45sm0'></ins><ul id='45sm0'></ul><sub id='45sm0'></sub></form><legend id='45sm0'></legend><bdo id='45sm0'><pre id='45sm0'><center id='45sm0'></center></pre></bdo></b><th id='45sm0'></th></span></q></dt></tr></i><div id='45sm0'><tfoot id='45sm0'></tfoot><dl id='45sm0'><fieldset id='45sm0'></fieldset></dl></div>
                <bdo id='45sm0'></bdo><ul id='45sm0'></ul>
                <tfoot id='45sm0'></tfoot>

                • 本文介绍了WebDriverException:消息:未知错误:Chrome 无法启动:通过 VPS 上的 Python 使用 ChromeDriver Chrome 和 Selenium 异常退出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  所以我和这些帖子有完全相同的错误

                  So I have the exact same error as these posts

                  Selenium 'Chrome 启动失败:异常退出' 错误

                  未知错误:Chrome 启动失败:异常退出

                  我尝试了他们推荐的方法,但没有奏效.

                  I tried what they recommended and it didn't work.

                  这是我的代码

                  from pyvirtualdisplay import Display
                  from selenium import webdriver
                  
                  display = Display(visible=0, size=(800, 600))
                  display.start()
                  
                  options = webdriver.ChromeOptions()
                  options.add_argument('--no-sandbox')
                  options.add_argument('--disable-extensions')
                  options.add_argument('--headless')
                  options.add_argument('--disable-gpu')
                  
                  driver = webdriver.Chrome(chrome_options=options)
                  driver.get('http://nytimes.com')
                  print(driver.title)
                  
                  driver.close()
                  

                  这是完整的错误信息

                  Traceback (most recent call last):
                    File "seleniumtest.py", line 13, in <module>
                      driver = webdriver.Chrome(chrome_options=options)
                    File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/chrome/webdriver.py", line 81, in __init__
                      desired_capabilities=desired_capabilities)
                    File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.py", line 157, in __init__
                      self.start_session(capabilities, browser_profile)
                    File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.py", line 252, in start_session
                      response = self.execute(Command.NEW_SESSION, parameters)
                    File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
                      self.error_handler.check_response(response)
                    File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/errorhandler.py", line 242, 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.30.477691 (6ee44a7247c639c0703f291d320bdf05c1531b57),platform=Linux 4.15.0-42-generic x86_64)
                  

                  我到底做错了什么?我在 digitalocean 上的 ubuntu VPS 上运行它.

                  What the devil am I doing wrong? I'm running this on an ubuntu VPS on digitalocean.

                  推荐答案

                  这个错误信息...

                  selenium.common.exceptions.WebDriverException: Message: unknown error: Chrome failed to start: exited abnormally
                    (Driver info: chromedriver=2.30.477691 (6ee44a7247c639c0703f291d320bdf05c1531b57),platform=Linux 4.15.0-42-generic x86_64)
                  

                  ...暗示 ChromeDriver 无法启动/生成新的 WebBrowserChrome 浏览器 会话.

                  ...implies that the ChromeDriver was unable to initiate/spawn a new WebBrowser i.e. Chrome Browser session.

                  下面将讨论两个不兼容问题.

                  Headless Chrome 首次由 Google 团队 发布为 GA(一般可用性) 时,文章 Headless Chrome 入门提到:

                  When Headless Chrome was first released as GA (General Availability) by Google Team the article Getting Started with Headless Chrome mentioned that :

                  --disable-gpu                 # Temporarily needed if running on Windows.
                  

                  一个注释被添加为:

                  现在,如果您在 Windows 上运行,您还需要包含 --disable-gpu 标志.

                  Right now, you'll also want to include the --disable-gpu flag if you're running on Windows.

                  根据讨论 Headless:使 --disable-gpu 标志不必要 很明显:

                  --disable-gpu 标志在 LinuxMac OSX 上不再需要.一旦错误 SwiftShader 在无头模式下的 Windows 已修复.现在,由于这个问题被标记为 fixed,参数 --disable-gpu 现在应该是多余的了.

                  The --disable-gpu flag is no longer necessary on Linux or Mac OSX. It will also become unnecessary on Windows as soon as the bug SwiftShader fails an assert on Windows in headless mode is fixed. Now as this issue is marked fixed the argument --disable-gpu should be redundant now.

                  注意:您可以在 错误:gpu_process_transport_factory.cc(1007)-丢失 UI 共享上下文:在 Headless 模式下通过 ChromeDriver 初始化 Chrome 浏览器时

                  但是,您的主要问题是您使用的二进制文件版本之间的不兼容,如下所示:

                  However, your main issue is the incompatibility between the version of the binaries you are using as follows:

                  • 您正在使用 chromedriver=2.30
                  • chromedriver=2.30 的发布说明明确提到以下内容:

                  支持 Chrome v58-60

                  • 我们不知道您的 chrome 版本.假设您使用的是最新的 Chrome 版本之一:
                    • Chrome 版本 71
                    • Chrome 版本 72
                    • Chrome 版本 73
                      • Your chrome version is unknown to us. Assuming you are using on of the latest Chrome releases either among:
                        • Chrome version 71
                        • Chrome version 72
                        • Chrome version 73
                        • 所以 ChromeDriver v2.30Chrome 浏览器 v71-73

                          • 根据您的 Chrome 浏览器 版本升级 ChromeDriver 相应地遵循 指南如下:
                            • 如果您使用的是Chrome 73版,则需要下载ChromeDriver 73.0.3683.20
                            • 如果您使用的是 Chrome 版本 72,则需要下载 ChromeDriver 2.46 或 ChromeDriver 72.0.3626.69
                            • 如果您使用的是 Chrome 版本 71,则需要下载 ChromeDriver 2.46 或 ChromeDriver 71.0.3578.137
                            • 对于旧版本的 Chrome,请参阅 此讨论 支持它的 ChromeDriver 版本.
                            • Depending on your Chrome Browser version upgrade ChromeDriver accordingly following the guidelines below:
                              • If you are using Chrome version 73, you need to download ChromeDriver 73.0.3683.20
                              • If you are using Chrome version 72, you need to download ChromeDriver 2.46 or ChromeDriver 72.0.3626.69
                              • If you are using Chrome version 71, you need to download ChromeDriver 2.46 or ChromeDriver 71.0.3578.137
                              • For older version of Chrome, see this discussion for the version of ChromeDriver that supports it.

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

                              You can find a couple of relevant discussions in:

                              • OpenQA.Selenium.WebDriverException: 未知错误:Chrome 无法启动:在 linux 上通过 Selenium start 执行测试时异常退出
                              • WebDriverException:消息:未知错误:Chrome 无法启动:在 debian 服务器上使用 ChromeDriver Chrome 和 Selenium 异常退出
                              • 消息:未知错误:Chrome 无法启动:在 AWS Cloud9 上使用 Linux 4.9.85-38.58.amzn1.x86_64 x86_64 异常退出

                              这篇关于WebDriverException:消息:未知错误:Chrome 无法启动:通过 VPS 上的 Python 使用 ChromeDriver Chrome 和 Selenium 异常退出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                              本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Kivy 1.9.0 Windows package KeyError: #39;rthooks#39;(Kivy 1.9.0 Windows 包 KeyError: rthooks)
                  Python Kivy: how to call a function on button click?(Python Kivy:如何在按钮单击时调用函数?)
                  How to disable a widget in Kivy?(如何禁用 Kivy 中的小部件?)
                  Centering an object in Kivy(在 Kivy 中将对象居中)
                  How to downgrade to Python 3.4 from 3.5(如何从 Python 3.5 降级到 Python 3.4)
                  Change button or label text color in kivy(在kivy中更改按钮或标签文本颜色)

                        <legend id='8toor'><style id='8toor'><dir id='8toor'><q id='8toor'></q></dir></style></legend>
                          <tbody id='8toor'></tbody>

                        <tfoot id='8toor'></tfoot>

                        <small id='8toor'></small><noframes id='8toor'>

                      • <i id='8toor'><tr id='8toor'><dt id='8toor'><q id='8toor'><span id='8toor'><b id='8toor'><form id='8toor'><ins id='8toor'></ins><ul id='8toor'></ul><sub id='8toor'></sub></form><legend id='8toor'></legend><bdo id='8toor'><pre id='8toor'><center id='8toor'></center></pre></bdo></b><th id='8toor'></th></span></q></dt></tr></i><div id='8toor'><tfoot id='8toor'></tfoot><dl id='8toor'><fieldset id='8toor'></fieldset></dl></div>
                          • <bdo id='8toor'></bdo><ul id='8toor'></ul>