zoukankan      html  css  js  c++  java
  • Python+Selenium

    Chrome Firefox

    下载浏览器版本对应的驱动文件后,放在D:Program Files (x86)PythonPython38路径下,Python使用时用 driver = webdriver.Chrome()  即可

    火狐  driver = webdriver.Firefox()

    突发问题:Chrome自动更新,导致驱动版本不匹配。解决方法:停止Chrome的自动更新,不然每次都要重新下载驱动

    Edge 

    下载驱动后要在浏览器安装路径下放一个:C:Program Files (x86)MicrosoftEdgeApplication

    又要在Python安装路径下放一个D:Program Files (x86)PythonPython38

    并且使用时要 driver = webdriver.Edge("C:Program Files (x86)MicrosoftEdgeApplicationmsedgedriver.exe")

    否则会报错

    WebDriverException(
    selenium.common.exceptions.WebDriverException: Message: 'MicrosoftWebDriver.exe' executable needs to be in PATH. Please download from http://go.microsoft.com/fwlink/?LinkId=619687

    IE

    驱动的版本号是看selenium的版本号,不是看IE浏览器的。

    先查看selenium版本号,在cmd窗口输入 pip list ,查询电脑已安装的所有第三方库,其中就有selenium

     知道selenium版本号后,下载驱动 http://selenium-release.storage.googleapis.com/index.html

     下载后解压,把驱动文件放在 D:Program Files (x86)PythonPython38  (同Chrome/火狐同样做法),即可

    使用命令 driver = webdriver.Ie()

  • 相关阅读:
    AC 自动机
    [HihoCoder-1424] Asa's Chess Problem
    C++ Tricks
    2017"百度之星"程序设计大赛
    后缀自动机
    ASP教程:gb2312和utf-8乱码问题解决
    cryto-js 常用加密库 md5加密
    nrm是什么?以及nrm的安装与命令
    MongoDB 安装
    koa2 安装与启动
  • 原文地址:https://www.cnblogs.com/sue2015/p/14846187.html
Copyright © 2011-2022 走看看