当前位置:网站首页>Selenium use -- installation and testing
Selenium use -- installation and testing
2022-07-25 12:39:00 【Smell and break bamboo】
List of articles
install selenium
In general , Use it directly pip Can be installed
pip install selenium
But if you meet urllib3 Version conflict of , It needs to be solved like this
First uninstall the original selenium and urllib3
pip uninstall selenium
pip uninstall urllib3
Install a specific version of urlib3
pip install urllib3==1.25.11
Install a specific version of selenium
pip install selenium==4.0.0.a1
Configure browser driver
If you want to selenium It can drive the browser into automatic test mode , You need to install the driver of a specific browser
Determine the browser version
Enter in the address field
chrome://version

Get into Taobao mirror Download to drive



Configure boot environment
Decompress the downloaded compressed package , Get one chromedriver.exe Program ( Suppose the file path of the program is :D:\Code\Selenium_Test), You need to configure this path into the environment variable .
test
After configuring the appeal process , You can use the following code to test
from selenium import webdriver
driver = webdriver.Chrome() # Create a Chrome Of driver Instance object
# Access page
driver.get(url="https://www.baidu.com/")
# Search the page id by kw Box of , Input xxx
driver.find_element_by_id("kw").send_keys("xxx")
# Search the page id by su The button , Click
driver.find_element_by_id("su").click()
# sign out
# driver.quit()
边栏推荐
- 我在源头SQLServer里面登记绝对删除的数据,传到MaxComputer,在数据清洗的时候写绝对
- [ROS advanced chapter] Lecture 9 programming optimization of URDF and use of xacro
- Can't delete the blank page in word? How to operate?
- 防范SYN洪泛攻击的方法 -- SYN cookie
- Does MySQL have flush privileges
- Keeping MySQL highly available
- Interviewer: "classmate, have you ever done a real landing project?"
- 【十】比例尺添加以及调整
- Jenkins configuration pipeline
- numpy初识
猜你喜欢

什么是CI/CD?
Software testing interview question: Please list the testing methods of several items?

Pytorch visualization

Microsoft azure and Analysys jointly released the report "Enterprise Cloud native platform driven digital transformation"

cmake 学习使用笔记(二)库的生成与使用

【Rust】引用和借用,字符串切片 (slice) 类型 (&str)——Rust语言基础12

Zuul gateway use

【Flutter -- 实例】案例一:基础组件 & 布局组件综合实例

A method to prevent SYN flooding attacks -- syn cookies

Technical management essay
随机推荐
Leetcode 0133. clone diagram
艰辛的旅程
Ecological profile of pytorch
Pytorch project practice - fashionmnist fashion classification
perf 性能调试
循环创建目录与子目录
Monit installation and use
Pairwise comparison of whether the mean values between R language groups are the same: pairwise hypothesis test of the mean values of multiple grouped data is performed using pairwise.t.test function
2022 Henan Mengxin League game (3): Henan University I - Travel
力扣 83双周赛T4 6131.不可能得到的最短骰子序列、303 周赛T4 6127.优质数对的数目
Script set random user_ agent
2022.07.24(LC_6124_第一个出现两次的字母)
MySQL练习二
Pytorch visualization
Deep learning MEMC framing paper list
WPF项目入门1-简单登录页面的设计和开发
Fault tolerant mechanism record
【八】取色器的巧用
水博士2
【4】 Layout view and layout toolbar usage