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

      • <bdo id='uIu0F'></bdo><ul id='uIu0F'></ul>

      <small id='uIu0F'></small><noframes id='uIu0F'>

      <legend id='uIu0F'><style id='uIu0F'><dir id='uIu0F'><q id='uIu0F'></q></dir></style></legend>
      1. 如何修复 Selenium WebDriverException:浏览器似乎在我们连接之前已经退出?

        时间:2023-07-04
      2. <i id='6Ds1t'><tr id='6Ds1t'><dt id='6Ds1t'><q id='6Ds1t'><span id='6Ds1t'><b id='6Ds1t'><form id='6Ds1t'><ins id='6Ds1t'></ins><ul id='6Ds1t'></ul><sub id='6Ds1t'></sub></form><legend id='6Ds1t'></legend><bdo id='6Ds1t'><pre id='6Ds1t'><center id='6Ds1t'></center></pre></bdo></b><th id='6Ds1t'></th></span></q></dt></tr></i><div id='6Ds1t'><tfoot id='6Ds1t'></tfoot><dl id='6Ds1t'><fieldset id='6Ds1t'></fieldset></dl></div>
        <legend id='6Ds1t'><style id='6Ds1t'><dir id='6Ds1t'><q id='6Ds1t'></q></dir></style></legend>

          <tbody id='6Ds1t'></tbody>
          <bdo id='6Ds1t'></bdo><ul id='6Ds1t'></ul>
            • <small id='6Ds1t'></small><noframes id='6Ds1t'>

              <tfoot id='6Ds1t'></tfoot>

                • 本文介绍了如何修复 Selenium WebDriverException:浏览器似乎在我们连接之前已经退出?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我已经在我的 centos6.4 服务器上安装了 firefox 和 Xvfb 来使用 selenium webdriver.

                  I have installed firefox and Xvfb on my centos6.4 server to use selenium webdriver.

                  但是,当我运行代码时,我得到了一个错误.

                  But, when I run the code, I got an error.

                  from selenium import webdriver
                  browser = webdriver.Firefox()
                  

                  错误

                  selenium.common.exceptions.WebDriverException: Message: 
                  'The browser appears to have exited before we could connect. The output was: None'
                  

                  我在 stackoverflow 上阅读了一些相关页面,有人建议删除 tmp 文件夹中的所有文件,所以我做到了.但是还是不行.

                  I read some related pages on stackoverflow and someone suggested to remove all files in tmp folder, so I did it. But, it still doesn't work.

                  谁能帮帮我?

                  提前谢谢你!

                  编辑

                  Traceback (most recent call last):
                    File "<stdin>", line 1, in <module>
                    File "/usr/local/lib/python3.4/site-packages/selenium/webdriver/firefox/webdriver.py", line 59, in __init__
                      self.binary, timeout),
                    File "/usr/local/lib/python3.4/site-packages/selenium/webdriver/firefox/extension_connection.py", line 47, in __init__
                      self.binary.launch_browser(self.profile)
                    File "/usr/local/lib/python3.4/site-packages/selenium/webdriver/firefox/firefox_binary.py", line 64, in launch_browser
                      self._wait_until_connectable()
                    File "/usr/local/lib/python3.4/site-packages/selenium/webdriver/firefox/firefox_binary.py", line 103, in _wait_until_connectable
                      self._get_firefox_output())
                  selenium.common.exceptions.WebDriverException: Message: 'The browser appears to have exited     before we could connect. The output was: None' 
                  

                  推荐答案

                  对于 Google 员工来说,这个答案对我不起作用,我不得不使用 这个答案.我正在使用 AWS Ubuntu.

                  for Googlers, this answer didn't work for me, and I had to use this answer instead. I am using AWS Ubuntu.

                  基本上,我需要先安装 Xvfb,然后再安装 pyvirtualdisplay:

                  Basically, I needed to install Xvfb and then pyvirtualdisplay:

                  sudo apt-get install xvfb
                  sudo pip install pyvirtualdisplay
                  

                  一旦我这样做了,这个 python 代码就可以工作了:

                  Once I had done that, this python code worked:

                  #!/usr/bin/env python
                  
                  from pyvirtualdisplay import Display
                  from selenium import webdriver
                  
                  display = Display(visible=0, size=(1024, 768))
                  display.start()
                  
                  browser = webdriver.Firefox()
                  browser.get('http://www.ubuntu.com/')
                  print browser.page_source
                  
                  browser.close()
                  display.stop()
                  

                  感谢@That1Guy 的第一个回答

                  Thanks to @That1Guy for the first answer

                  这篇关于如何修复 Selenium WebDriverException:浏览器似乎在我们连接之前已经退出?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:用于处理弹出浏览器窗口的 Python webdriver 不是警报 下一篇:在 selenium 中不推荐使用 find_element_by_* 命令

                  相关文章

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

                  1. <small id='uAPLp'></small><noframes id='uAPLp'>

                    1. <legend id='uAPLp'><style id='uAPLp'><dir id='uAPLp'><q id='uAPLp'></q></dir></style></legend>