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

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

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

      1. 'selenium.common.exceptions.WebDriverException:消息:u'

        #39;selenium.common.exceptions.WebDriverException: Message: u#39;chrome not reachable(selenium.common.exceptions.WebDriverException:消息:uchrome 无法访问)
        <i id='t87jB'><tr id='t87jB'><dt id='t87jB'><q id='t87jB'><span id='t87jB'><b id='t87jB'><form id='t87jB'><ins id='t87jB'></ins><ul id='t87jB'></ul><sub id='t87jB'></sub></form><legend id='t87jB'></legend><bdo id='t87jB'><pre id='t87jB'><center id='t87jB'></center></pre></bdo></b><th id='t87jB'></th></span></q></dt></tr></i><div id='t87jB'><tfoot id='t87jB'></tfoot><dl id='t87jB'><fieldset id='t87jB'></fieldset></dl></div>

        <tfoot id='t87jB'></tfoot>

      2. <small id='t87jB'></small><noframes id='t87jB'>

              <legend id='t87jB'><style id='t87jB'><dir id='t87jB'><q id='t87jB'></q></dir></style></legend>
                <tbody id='t87jB'></tbody>

                • <bdo id='t87jB'></bdo><ul id='t87jB'></ul>
                  本文介绍了'selenium.common.exceptions.WebDriverException:消息:u'chrome 无法访问的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在使用 webdriver 来配置路由器,但是当我运行脚本时:

                  I'm using webdriver to config a router, but when I run script:

                  from selenium import webdriver
                  self.driver = webdriver.Chrome()
                  

                  打开chrome没有反应,然后引发异常:

                  It opens chrome and no response, and then raise exception:

                  chrome 无法访问.

                  chrome not reachable.

                  我的电脑有两张网卡,当我禁止一个时,它工作得很好.
                  我不知道为什么,请帮忙!

                  My computer has two network cards, when I forbbiden one, it works well.
                  I don't konw why, please help!

                  推荐答案

                  纯情况下chrome not reachable"表示Chrome二进制可以启动但调试端口不可达.

                  In pure case "chrome not reachable" means that Chrome binary can be started but debugging port is not reachable.

                  调试端口由参数设置:--remote-debugging-port=12582

                  Debugging port is set by argument: --remote-debugging-port=12582

                  就我而言,这是因为沙盒的一些问题:

                  In my case it happens because some issues with sand-box:

                  ps afvvx | grep chrome
                  
                  /opt/google/chrome/chrome --disable-background-networking --disable-client-side-phishing
                  21026 pts/2    S+     0:00      0    47  6008   100  0.0  |           \_ cat
                  21027 pts/2    S+     0:00      0    47  6008   100  0.0  |           \_ cat
                  21029 pts/2    Z+     0:00      0     0     0     0  0.0  |           \_ [chrome-sandbox] <defunct>
                  

                  当我运行/opt/google/chrome/chrome-sandbox

                  When I run /opt/google/chrome/chrome-sandbox

                  # /opt/google/chrome/chrome-sandbox  -h
                  The setuid sandbox provides API version 1, but you need 0
                  Please read [https://code.google.com/p/chromium/wiki/LinuxSUIDSandboxDevelopment][1].
                  
                  close: Bad file descriptor
                  Read on socketpair: Success
                  

                  从上面的 url 我无法得到修复 SUID SandBox 的方法,但可以通过 Chrome arg --disable-setuid-sandbox(有时使用 --no-sandbox)将其关闭:

                  From url above I can't get what I'll to do to fix SUID SandBox, but it can be switched off by Chrome arg --disable-setuid-sandbox(sometimes with --no-sandbox):

                  import time
                  from selenium import webdriver
                  
                  from xvfbwrapper import Xvfb
                  
                  vdisplay = Xvfb()
                  vdisplay.start()
                  
                  from selenium.webdriver.chrome.options import Options
                  chrome_options = Options()
                  chrome_options.add_argument("--no-sandbox")
                  chrome_options.add_argument("--disable-setuid-sandbox")
                  
                  driver = webdriver.Chrome('/usr/local/sbin/chromedriver', chrome_options=chrome_options)  # Optional argument, if not specified will search path.
                  driver.get('http://www.google.com/xhtml');
                  time.sleep(5) # Let the user actually see something!
                  search_box = driver.find_element_by_name('q')
                  search_box.send_keys('ChromeDriver')
                  search_box.submit()
                  time.sleep(5) # Let the user actually see something!
                  driver.quit()
                  
                  vdisplay.stop()
                  

                  这篇关于'selenium.common.exceptions.WebDriverException:消息:u'chrome 无法访问的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  env: python: No such file or directory(env: python: 没有这样的文件或目录)
                  How to evaluate environment variables into a string in Python?(如何在 Python 中将环境变量评估为字符串?)
                  Python - temporarily modify the current process#39;s environment(Python - 临时修改当前进程的环境)
                  Change current process environment#39;s LD_LIBRARY_PATH(更改当前进程环境的 LD_LIBRARY_PATH)
                  Reading and writing environment variables in Python?(在 Python 中读写环境变量?)
                  When to use sys.path.append and when modifying %PYTHONPATH% is enough(何时使用 sys.path.append 以及何时修改 %PYTHONPATH% 就足够了)

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

                      <tfoot id='pudhT'></tfoot>
                        <bdo id='pudhT'></bdo><ul id='pudhT'></ul>
                          <tbody id='pudhT'></tbody>

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

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