zoukankan      html  css  js  c++  java
  • Python3.6+selenium3.8+Firefox5.7 环境搭建

      大家好,我是阿哲,本人是从php转岗过来学习测试的一名小菜!

      在学习selenium过程中,发现运行selenium有很多的问题。

      我们在利用pip install selenium 安装的最新版后,默认是不支持最新版本的Firefox浏览器。

      报错提示:

    selenium.common.exceptions.WebDriverException: Message: Unable to find a matching set of capabilities

      这时,需要我们去selenium官网下载一个驱动文件,由于官网经常打不开,这边直接提供github的下载地址

         1.chromedriver 下载地址:https://code.google.com/p/chromedriver/downloads/list
         2.Firefox的驱动geckodriver 下载地址:https://github.com/mozilla/geckodriver/releases/
         3.IE的驱动IEdriver 下载地址:http://www.nuget.org/packages/Selenium.WebDriver.IEDriver/


      大家可以根据自己电脑所使用的浏览器下载对应的驱动文件,解压后移到Python安装目录下。

      这时,我们再去IDLE中写入我们的测试代码

    from selenium import webdriver     #导入webdriver包
    driver =webdriver.Firefox()
    driver.get('http://www.baidu.com')

      如果,浏览器自动弹起并且打开了百度,就表明 环境我们已经正常安装。

      由于谷歌浏览器的话会有一个提示,那么在这里建议大家使用Firefox浏览器。

      之后,大家就可以开始任意的使用selenium带给你各种操作浏览器的快感了!

  • 相关阅读:
    洛谷 P1200.[USACO1.1]你的飞碟在这儿Your Ride Is Here
    洛谷 P1055.ISBN号码
    洛谷 P1567.统计天数
    洛谷 P2141.珠心算测验
    洛谷 P1428.小鱼比可爱
    洛谷 P1427.小鱼的数字游戏
    洛谷 P1047.校门外的树
    洛谷 P1046.陶陶摘苹果
    洛谷 P1980.计数问题
    洛谷 P1424.小鱼的航程(改进版)
  • 原文地址:https://www.cnblogs.com/testzhe/p/7999213.html
Copyright © 2011-2022 走看看