<legend id='liM6v'><style id='liM6v'><dir id='liM6v'><q id='liM6v'></q></dir></style></legend><tfoot id='liM6v'></tfoot>

        <bdo id='liM6v'></bdo><ul id='liM6v'></ul>
    1. <small id='liM6v'></small><noframes id='liM6v'>

        <i id='liM6v'><tr id='liM6v'><dt id='liM6v'><q id='liM6v'><span id='liM6v'><b id='liM6v'><form id='liM6v'><ins id='liM6v'></ins><ul id='liM6v'></ul><sub id='liM6v'></sub></form><legend id='liM6v'></legend><bdo id='liM6v'><pre id='liM6v'><center id='liM6v'></center></pre></bdo></b><th id='liM6v'></th></span></q></dt></tr></i><div id='liM6v'><tfoot id='liM6v'></tfoot><dl id='liM6v'><fieldset id='liM6v'></fieldset></dl></div>
      1. WebDriverException:消息:“chromedriver"可执行文件需要在 PATH 中,同时通

        时间:2023-06-05

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

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

              <tfoot id='o0YTI'></tfoot>

                <tbody id='o0YTI'></tbody>
                <bdo id='o0YTI'></bdo><ul id='o0YTI'></ul>
                1. 本文介绍了WebDriverException:消息:“chromedriver"可执行文件需要在 PATH 中,同时通过 Selenium Chromedriver python 设置 UserAgent的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我是网络抓取的新手,我正在尝试使用以下代码来修改我的用户代理:

                  I'm a newbie in webscraping, I'm trying to modify my user agent using these lines :

                  from selenium import webdriver
                  chrome_path = r'C:UsersDesktopchromedriver_win32chromedriver.exe'   
                  driver = webdriver.Chrome(chrome_path)
                  options = webdriver.ChromeOptions()
                  options.add_argument('user-agent = Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36')
                  driver = webdriver.Chrome(chrome_options=options)
                  

                  环境变量中的路径没有问题,但我一直收到此错误消息:

                  The path in environment variable is ok but I keep having this error message:

                  File "C:UsersAppDataLocalProgramsPythonPython36-32libsite-packagesseleniumwebdrivercommonservice.py", line 76, in startstdin=PIPE)
                  File "C:UsersAppDataLocalProgramsPythonPython36-32libsubprocess.py",line 709, in __init__restore_signals, start_new_session)
                  File "C:UsersAppDataLocalProgramsPythonPython36-32libsubprocess.py",line 997, in _execute_child startupinfo).
                  During handling of the above exception, another exception occurred:
                  Traceback (most recent call last):
                  File "C:UserssafiaAppDataLocalProgramsPythonPython36-32Test 3- User Agent.py", line 9, in <module>
                  driver = webdriver.Chrome(chrome_options=options)
                  File "C:UserssafiaAppDataLocalProgramsPythonPython36-32libsite-packagesseleniumwebdriverchromewebdriver.py", line 68, in __init__
                  self.service.start()
                  File "C:UserssafiaAppDataLocalProgramsPythonPython36-32libsite-packagesseleniumwebdrivercommonservice.py", line 83, 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
                  

                  你能帮我解决这个问题吗?

                  Can you please help me fix this issue?

                  推荐答案

                  这个错误信息...

                  selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable needs to be in PATH
                  

                  ...暗示 ChromeDriver环境变量 内的 PATH 变量中指定的位置中找不到.

                  ...implies that the ChromeDriver was not found within the locations specified within PATH variable within Environment Variables.

                  您需要传递 Key executable_path 以及 Value 引用 ChromeDriver 的绝对路径连同 ChromeOptions 对象作为参数,同时初始化 WebDriverWebBrowser,如下所示:

                  You need to pass the Key executable_path along with the Value referring to the absolute path of the ChromeDriver along with the ChromeOptions object as an argument while initializing the WebDriver and WebBrowser as follows :

                  from selenium import webdriver
                  
                  options = webdriver.ChromeOptions()
                  options.add_argument('user-agent = Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36')
                  driver = webdriver.Chrome(chrome_options=options, executable_path=r'C:UsersDesktopchromedriver_win32chromedriver.exe')
                  driver.get('https://www.google.co.in')
                  

                  这篇关于WebDriverException:消息:“chromedriver"可执行文件需要在 PATH 中,同时通过 Selenium Chromedriver python 设置 UserAgent的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:如何让 Selenium 不等到整个页面加载,它的脚本很慢? 下一篇:未知错误:由于未知错误导致页面崩溃,会话被删除:无法从 ChromeDriver Selenium 崩溃的选项卡中确定加

                  相关文章

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

                    <tfoot id='nCvPn'></tfoot>

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