【问题标题】:Error while executing the chromedriver in python在 python 中执行 chromedriver 时出错
【发布时间】:2020-04-13 13:38:41
【问题描述】:

在 selenium-python 中执行 chromedriver 时遇到以下错误。

错误:WebDriverException:“chromedriver”可执行文件需要在 PATH 中。请看https://sites.google.com/a/chromium.org/chromedriver/home

driver = webdriver.Chrome(executable_path="F:/SSN/SSN/Python/chromedriver")

【问题讨论】:

    标签: python-3.x selenium-chromedriver


    【解决方案1】:

    你可以尝试如下

    driver = webdriver.Chrome(executable_path=r'Path_to_chrome_Driver\\chromedriver.exe')
    

    请下载 selenium 的 chrome 驱动程序Chrome Driver。然后输入chrome驱动位置。

    注意:请确保您已根据您的 chrome 浏览器版本下载正确的 chromedriver。

    【讨论】:

      【解决方案2】:
      driver: WebDriver = webdriver.Chrome("/Users/this can change/PycharmProjects/this is the title of the project/drivers/chromedriver")
      

      为了达到上述目的: 1)下载Chromedriver(我猜你已经这样做了) 2) 在您的项目标题上(如果您使用 pycharm,它在左上角),然后单击 dx 打开菜单>新建>目录,并将新目录的名称命名为“驱动程序”。 3)从下载forlder,或您的chromedriver.exe文件在步骤1)中下载的任何位置,将其拖到“下载”文件夹中。 4)右键单击文件夹“驱动程序”>单击“复制路径” 5)在driver: WebDriver = webdriver.Chrome("HERE")之后的“复制路径”过去

      如果这个解释听起来很难,请点击这里:https://www.youtube.com/watch?v=eDrFWRi13DY

      【讨论】:

      • (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape, 现在出现上述错误
      • 您可以分享您的编码吗?所以我可以看到可能是什么问题
      • from selenium import webdriver from bs4 import BeautifulSoup import pandas as pd driver = webdriver.chrome(executable_path='C:\Users\a02450\Desktop\Stock\chromedriver_win3\chromedriver.exe')
      • 即使我在 'c:\ 前面添加 r 并删除了 executable_path= 也会遇到同样的错误
      • 对不起,如果你不能分享你的代码,我很难理解,因为我不是专家
      猜你喜欢
      • 2020-10-13
      • 1970-01-01
      • 2018-08-10
      • 1970-01-01
      • 2021-08-19
      • 2021-06-15
      • 2011-04-20
      • 2021-03-25
      • 2020-03-06
      相关资源
      最近更新 更多