1.查看自己chrome的版本 2.下载浏览器版本对应的chromeDrive chrom驱动下载地址: ------
1.检察本身chrome的版本
2.下载浏览器版本对应的chromeDrive
chrom驱动下载地点:
--------------------------------------------------------------------------------------------------------------------------
Firefox驱动geckodriver 下载地点:https://github.com/mozilla/geckodriver/releases/
IE的驱动IEdriver下载地点:
--------------------------------------------------------------------------------------------------------------------------
3.将下载好的chromeDriver解压好复制到谷歌浏览器安置目录,将谷歌浏览器安置路径添加环境变量中
3.安置pycharm,安置要领参考:
https://www.runoob.com/w3cnote/pycharm-windows-install.html
4.打开pycharm 使用pip下载selenium模块
pip install -U selenium
5.新建一个python文件,,开始编写测试脚本
# -*- coding: utf-8 -*- from selenium import webdriver from selenium.webdriver.support.select import Select import time # 打开浏览器,且打开xxxx页面 url = ‘‘ driver = webdriver.Chrome(executable_path="C:\Program Files (x86)\Google\Chrome\Application\chromedriver.exe") driver.get(url) #延时2秒 time.sleep(2) # 通过id定位xx按钮,点击 driver.find_element_by_class_name("xx按钮的类名").click() #延时2秒 time.sleep(2)
webDriver的安置法式和使用说明(已chrome为例)
温馨提示: 本文由Jm博客推荐,转载请保留链接: https://www.jmwww.net/file/web/33176.html
- 上一篇:故可以轻松地判断证书不合法
- 下一篇: 以上只是Okhttp最简单的流程分析