当前位置:网站首页>selenium,元素操作以及浏览器操作方法
selenium,元素操作以及浏览器操作方法
2022-07-02 10:18:00 【杂学者】
一、元素操作
点击操作:元素.click()
输入操作:元素.send_key()
清除操作:元素.clear()
例如:
二、浏览器操作
常用的方法:
maximize_window()----最大化浏览器
set_window_size(width,height)----设置浏览器窗口的大小,宽、高为像素点。
set_window_position(x,y)----设置浏览器窗口左上角点所在显示器的位置(像素点的位置)
back()----后退,相当于浏览器中的后退按钮
forward()----前进,相当于浏览器中的前进按钮
close()----关闭浏览器当前的标签页(不是关闭整个浏览器)
quit()----关闭整个浏览器
title----获取浏览器的title(浏览器标签页顶部显示的内容)
current----获取浏览器url地址
三、获取元素信息
常用的方法:
size----返回元素大小
text----返回元素的文本内容
get_attribute("abd")----获取属性值,abc为属性的名称
is_displayed()----判断元素是否可见
is_enabled()----判断元素是否可用
is_selected()----判断元素是否被选中,主要用在类似复选框、单选按钮上
边栏推荐
- 你的 Sleep 服务会梦到服务网格外的 bookinfo 吗
- [youcans' image processing learning course] general contents
- Download files and preview pictures
- Three methods of finding LCA of the nearest common ancestor
- We sincerely invite young creators to share with investors and entrepreneurs how to make choices in life in the metauniverse
- Redis database persistence
- Which do you choose between Alibaba P7 with an annual salary of 900000 and deputy department level cadres?
- Integral link, inertia link and proportion link in Simulink
- 最近公共祖先LCA的三种求法
- De4000h storage installation configuration
猜你喜欢
SAP MM 因物料有负库存导致MMPV开账期失败问题之对策
rxjs Observable 自定义 Operator 的开发技巧
[cloud native database] what to do when encountering slow SQL (Part 1)?
uniapp小程序 subPackages分包配置
Don't spend money, spend an hour to build your own blog website
Unity skframework framework (XXI), texture filter map resource filtering tool
Find love for speed in F1 delta time Grand Prix
[OpenGL] notes 29. Advanced lighting (specular highlights)
Gee learning notes 2
【OpenGL】笔记二十九、高级光照(镜面高光)
随机推荐
Chinese name extraction (toy code - accurate head is too small, right to play)
Common options of tcpdump command: Three
OpenFOAM:lduMatrix&lduAddressing
What are eNB, EPC and PGW?
2022零代码/低代码开发白皮书【伙伴云出品】附下载
【笔耕不辍勋章活动】生命不止,写作不息
mac(macos Monterey12.2 m1) 个人使用php开发
numpy数组计算
[Blue Bridge Cup] children's worship circle
D为何链接不了dll
记忆函数的性能优化
Astro learning notes
Unity skframework framework (XIII), question module
What are the classifications of SSL certificates? How to choose the appropriate SSL certificate?
Solution: Compression Technology (original version and sequel version)
最近公共祖先LCA的三种求法
When tidb meets Flink: tidb efficiently enters the lake "new play" | tilaker team interview
Dingtalk 发送消息
免费SSL证书知多少?免费SSL证书和收费SSL证书的区别
Verification failed, please check your call back website. You can follow the instructions