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

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

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

    1. <tfoot id='LXCIq'></tfoot>

      Python Selenium Chrome 网络驱动程序

      时间:2023-06-06
        <tbody id='IxGdz'></tbody>
      <i id='IxGdz'><tr id='IxGdz'><dt id='IxGdz'><q id='IxGdz'><span id='IxGdz'><b id='IxGdz'><form id='IxGdz'><ins id='IxGdz'></ins><ul id='IxGdz'></ul><sub id='IxGdz'></sub></form><legend id='IxGdz'></legend><bdo id='IxGdz'><pre id='IxGdz'><center id='IxGdz'></center></pre></bdo></b><th id='IxGdz'></th></span></q></dt></tr></i><div id='IxGdz'><tfoot id='IxGdz'></tfoot><dl id='IxGdz'><fieldset id='IxGdz'></fieldset></dl></div>
    2. <small id='IxGdz'></small><noframes id='IxGdz'>

          <bdo id='IxGdz'></bdo><ul id='IxGdz'></ul>

            • <tfoot id='IxGdz'></tfoot>
              <legend id='IxGdz'><style id='IxGdz'><dir id='IxGdz'><q id='IxGdz'></q></dir></style></legend>
              1. 本文介绍了Python Selenium Chrome 网络驱动程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我正在开始自动化这本无聊的东西,我正在尝试通过 python 打开一个 chrome 网络浏览器.我已经安装了 selenium 和

                I'm beginning the automate the boring stuff book and I'm trying to open a chrome web browser through python. I have already installed selenium and

                我已尝试运行此文件:

                from selenium import webdriver
                from selenium.webdriver.common.by import By
                from selenium.webdriver.common.keys import Keys
                
                browser = webdriver.Chrome()
                browser.get('https://automatetheboringstuff.com')
                

                但正因为如此,我得到了这个错误:

                But because of that I get this Error:

                Traceback (most recent call last):   File "C:Program Files
                   (x86)Python36-32libsite-packagesseleniumwebdrivercommonservice.py",
                 line 74, in start
                     stdout=self.log_file, stderr=self.log_file)   File "C:Program Files (x86)Python36-32libsubprocess.py", line 707, in __init__
                     restore_signals, start_new_session)   File "C:Program Files (x86)Python36-32libsubprocess.py", line 990, in _execute_child
                     startupinfo) FileNotFoundError: [WinError 2] The system cannot find the file specified
                

                在处理上述异常的过程中,又发生了一个异常:

                During handling of the above exception, another exception occurred:

                Traceback (most recent call last):   File "C:/Program Files
                (x86)/Python36-32/test.py", line 5, in <module>
                    browser = webdriver.Chrome()   File "C:Program Files (x86)Python36-32libsite-packagesseleniumwebdriverchromewebdriver.py",
                line 62, in __init__
                   self.service.start()   File "C:Program Files (x86)Python36-32libsite-packagesseleniumwebdrivercommonservice.py",
                line 81, in start
                   os.path.basename(self.path), self.start_error_message) selenium.common.exceptions.WebDriverException: Message: 'chromedriver'
                  executable needs to be in PATH. Please see
                https://sites.google.com/a/chromium.org/chromedriver/home
                

                推荐答案

                你需要指定你的chromedriver所在的路径.

                1. 从此处下载所需平台的 chromedriver.

                将 chromedriver 放在系统路径或代码所在的位置.

                Place chromedriver on your system path, or where your code is.

                如果不使用系统路径,请链接您的 chromedriver.exe(对于非 Windows 用户,它只是称为 chromedriver):

                If not using a system path, link your chromedriver.exe (For non-Windows users, it's just called chromedriver):

                browser = webdriver.Chrome(executable_path=r"C:path	ochromedriver.exe")
                

                (将 executable_path 设置为您的 chromedriver 所在的位置.)

                (Set executable_path to the location where your chromedriver is located.)

                如果您已将 chromedriver 放置在系统路径中,则只需执行以下操作即可快捷方式:

                If you've placed chromedriver on your System Path, you can shortcut by just doing the following:

                browser = webdriver.Chrome()

                如果您运行的是基于 Unix 的操作系统,您可能需要在下载后更新 chromedriver 的权限以使其可执行:

                If you're running on a Unix-based operating system, you may need to update the permissions of chromedriver after downloading it in order to make it executable:

                chmod +x chromedriver

                就是这样.如果您仍然遇到问题,可以在其他 StackOverflow 文章中找到更多信息:可以'不要为 Selenium 使用 chrome 驱动程序

                That's all. If you're still experiencing issues, more info can be found on this other StackOverflow article: Can't use chrome driver for Selenium

                这篇关于Python Selenium Chrome 网络驱动程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                上一篇:使用 Selenium Python 和 chromedriver 截取整页截图 下一篇:未知错误:chrome 无法启动

                相关文章

                  <tfoot id='9mLAI'></tfoot>

                  <small id='9mLAI'></small><noframes id='9mLAI'>

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

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