自动化测试selenium (一)

本文将介绍Selenium自动化测试的基础知识,包括Selenium的作用、安装配置、基本使用方法及如何编写测试用例。通过实例解析,帮助读者快速掌握Selenium进行网页应用测试的技巧。
摘要由CSDN通过智能技术生成
1.pip安装 selenium
2.下载浏览器驱动
火狐:geckodriver.exe  https://pan.baidu.com/s/1GPXYBLNOW7PUbpPrCy0_YA
谷歌:https://npm.taobao.org/mirrors/chromedriver/
注:火狐是selenium默认的浏览器

3.下载好的驱动(geckodriver.exe )放于浏览器的安装目录下;
添加path到系统路径;
重启pytharm;

4.此外注意声明时路径
webdriver.Firefox(executable_path='c:/firefox安装目录/geckodriver.exe') 



# coding:utf-8
from selenium import webdriver
from selenium.webdriver.common.action_chains import ActionChains
import time

# seleninm 默认火狐浏览器, 或 webdriver.Firefox(executable_path='c:/geckodriver.exe') ;添加到系统path路径;重启pytharm。
driver = webdriver.Firefox()
driver.get("http://www.baidu.com")
driver.find_element_by_id("kw").send_keys("selenium")
driver.find_element_by_id("su").click()

#鼠标悬停 1
driver.get("https://www.baidu.com")
time.sleep(2)
ActionChains(driver).move_to_
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值