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

    3. WebDriverException:消息:“无法连接到 ChromeDriver&quo

      时间:2023-10-08
      <tfoot id='S5bVE'></tfoot>
        • <legend id='S5bVE'><style id='S5bVE'><dir id='S5bVE'><q id='S5bVE'></q></dir></style></legend>

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

                <tbody id='S5bVE'></tbody>

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

              • <bdo id='S5bVE'></bdo><ul id='S5bVE'></ul>
              • 本文介绍了WebDriverException:消息:“无法连接到 ChromeDriver".utils.is_connectable(self.port) 中的错误:的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                问题描述

                我正在尝试使用 chromedriver 2.10 在 CentOS 机器上的 Chrome 浏览器版本 35.0.1916.114 上运行测试

                /home/varunm/EC_WTF_0.4.10/EC_WTF0.4.10_Project/wtframework/wtf/drivers/chromedriver

                /home/varunm/EC_WTF_0.4.10/EC_WTF0.4.10_Project/wtframework/wtf/drivers/chromedriver

                实际上我修复了路径问题,因为如果问题与路径有关,则错误消息会有所不同

                Actually I fixed the path issue, because the error message was different if the issue was with path

                    def start(self):
                    """
                    Starts the ChromeDriver Service.
                
                    :Exceptions:
                     - WebDriverException : Raised either when it can't start the service
                       or when it can't connect to the service
                    """
                    env = self.env or os.environ
                    try:
                        self.process = subprocess.Popen([
                          self.path,
                          "--port=%d" % self.port] +
                          self.service_args, env=env, stdout=PIPE, stderr=PIPE)
                    except:
                        raise WebDriverException(
                            "ChromeDriver executable needs to be available in the path. 
                            Please download from http://chromedriver.storage.googleapis.com/index.html
                            and read up at http://code.google.com/p/selenium/wiki/ChromeDriver")
                    count = 0
                    while not utils.is_connectable(self.port):
                        count += 1
                        time.sleep(1)
                        if count == 30:
                             raise WebDriverException("Can not connect to the ChromeDriver")
                

                如果路径错误,我会收到一些其他错误,但现在错误是在建立连接时

                If the path was wrong I will receive some other error, but now the error is while making the connection

                推荐答案


                适用于 Linux

                1.检查你是否安装了最新版本的chrome brwoser-> "chromium-browser -version"
                2.如果没有,安装最新版本的chrome sudo apt-get install chromium-browser"
                3. 从以下链接获取适当版本的 chrome 驱动程序 http://chromedriver.storage.googleapis.com/index.html
                4.解压chromedriver.zip
                5.将文件移动到/usr/bin/目录sudo mv chromedriver/usr/bin/
                6. 转到/usr/bin/目录,你需要运行类似chmod a+x chromedriver"的东西来标记它可执行.
                7.终于可以执行代码了.


                For Linux

                1. Check you have installed latest version of chrome brwoser-> "chromium-browser -version"
                2. If not, install latest version of chrome "sudo apt-get install chromium-browser"
                3. get appropriate version of chrome driver from following link http://chromedriver.storage.googleapis.com/index.html
                4. Unzip the chromedriver.zip
                5. Move the file to /usr/bin/ directory sudo mv chromedriver /usr/bin/
                6. Goto /usr/bin/ directory and you would need to run something like "chmod a+x chromedriver" to mark it executable.
                7. finally you can execute the code.

                import os
                from selenium import webdriver
                from pyvirtualdisplay import Display
                display = Display(visible=0, size=(800, 600))
                display.start()
                driver = webdriver.Chrome()
                driver.get("http://www.google.com")
                print driver.page_source.encode('utf-8')
                driver.quit()
                display.stop()
                

                这篇关于WebDriverException:消息:“无法连接到 ChromeDriver".utils.is_connectable(self.port) 中的错误:的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                上一篇:使用 chromedriver &amp; 创建 Python 可执行文件硒 下一篇:ChromeDriver ERR_SSL_PROTOCOL_ERROR 尽管 --ignore-certifica

                相关文章

                最新文章

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

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

              • <tfoot id='Goma8'></tfoot>
                  <bdo id='Goma8'></bdo><ul id='Goma8'></ul>
              • <legend id='Goma8'><style id='Goma8'><dir id='Goma8'><q id='Goma8'></q></dir></style></legend>