新手pip之selenium

编程

  • 安装selenium

pip install selenium

  • WebDriverException

    • 解决方案:下载geckodriver
    • 下载链接: https://github.com/mozilla/geckodriver ,找到指定版本下载
    • 设置executable_path的值,即为geckodriver的下载的文件绝对路径
    • 我下载的文件路径: https://github.com/mozilla/geckodriver/releases/download/v0.26.0/geckodriver-v0.26.0-win64.zip

raise WebDriverException(

selenium.common.exceptions.WebDriverException: Message: "geckodriver" executable needs to be in PATH.

  • 成功运行

from selenium import webdriver

driver = webdriver.Firefox(executable_path=r"D:Programpythongeckodriver-v0.26.0-win64geckodriver.exe")

driver.get("https://my.oschina.net/wuxueshi/blog/4255914")

以上是 新手pip之selenium 的全部内容, 来源链接: utcz.com/z/516268.html

回到顶部