zoukankan      html  css  js  c++  java
  • 基于python的selenium自动化测试环境搭建

    重新搭建环境,现补充web自动化测试环境的搭建。

    学习selenium python需要的工具:
      1、浏览器
      2、Python
      3、Selenium
      4、FireBug(Firefox)
      5、chromedriver、IEDriverServer、geckodriver
      6、IDE(Pycharm/Sublime/Eclipse等等)
    一、浏览器
    这里使用firefox浏览器
    二、Python环境搭建
    三、Selenium安装
    使用pip安装:pip install selenium
    四、驱动安装geckodriver/chromedriver/IEDriverServer(Windows环境下)
    win64地址:https://pan.baidu.com/s/1guRndaCjR4RBZNvbokE3GA
    五、驱动使用方法:
    使用方法:
    1、下载完成解压;
    2、将geckodriver放到python文件下
    3、添加到环境变量中(例如:G:Python36geckodriver.exe)
    Chrome:
    如果需要使用Chrome浏览器或者IE浏览器,则需要对应的驱动,chromedriver,chromedriver没有64位版本,32即可驱动:
    下载地址:https://npm.taobao.org/mirrors/chromedriver
    使用方法同geckodriver。
    IE:
    IEDriverServer,下面链接能够下载所有版本的selenium以及IEDriverServer,注意IEDriverServer区分32位/64位:
    下载地址:http://selenium-release.storage.googleapis.com/index.html
    使用方法同geckodriver。
    六、测试打开浏览器
    输入以下代码:
    # -*- coding: utf-8 -*-
    from selenium import webdriver
    driver = webdriver.Firefox()
    driver.get("https://www.baidu.com")

  • 相关阅读:
    Leetcode 290 Word Pattern
    Leetcode 205 Isomorphic Strings
    Leetcode 345 Reverse Vowels in a String
    Leetcode 151 Reverse Words in a String
    Leetcode 344 Reverse String
    Leetcode 383 Ransom Note
    leetcode 387 First Unique Character in a String
    反码补码和位运算
    SpringBoot进阶
    布隆过滤器
  • 原文地址:https://www.cnblogs.com/LinxiHuang/p/9613737.html
Copyright © 2011-2022 走看看