当前位置:网站首页>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()----判断元素是否被选中,主要用在类似复选框、单选按钮上
边栏推荐
- 使用BLoC 构建 Flutter的页面实例
- Mysql常用命令详细大全
- JS逆向之行行查data解密
- 题解:《压缩技术》(原版、续集版)
- Student course selection information management system based on ssm+jsp framework [source code + database]
- Unity skframework framework (XIII), question module
- 大家信夫一站式信用平台让信用场景“用起来
- Web基础
- Bridge of undirected graph
- The 29 year old programmer in Shanghai was sentenced to 10 months for "deleting the database and running away" on the day of his resignation!
猜你喜欢

研究表明“气味相投”更易成为朋友

SAP MM 因物料有负库存导致MMPV开账期失败问题之对策

Explanation: here is your UFO, Goldbach conjecture

伙伴云表格强势升级!Pro版,更非凡!

What are eNB, EPC and PGW?

Chinese name extraction (toy code - accurate head is too small, right to play)

最近公共祖先LCA的三种求法

Origin绘制热重TG和微分热重DTG曲线

Error function ERF
![2022 zero code / low code development white paper [produced by partner cloud] with download](/img/46/92c51090e0c476df3bcffd2d11fb6d.png)
2022 zero code / low code development white paper [produced by partner cloud] with download
随机推荐
Three methods of finding LCA of the nearest common ancestor
[true topic of the Blue Bridge Cup trials 43] scratch space flight children's programming explanation of the true topic of the Blue Bridge Cup trials
D how to check null
Gee learning notes 2
[technology development-22]: rapid overview of the application and development of network and communication technology-2-communication Technology
[youcans' image processing learning course] general contents
Tupang multi-target tracking! BOT sort: robust correlated multi pedestrian tracking
Unity skframework framework (XVII), freecameracontroller God view / free view camera control script
P3008 [USACO11JAN]Roads and Planes G (SPFA + SLF优化)
numpy数组计算
Unity skframework framework (XIX), POI points of interest / information points
【蓝桥杯选拔赛真题43】Scratch航天飞行 少儿编程scratch蓝桥杯选拔赛真题讲解
诚邀青年创作者,一起在元宇宙里与投资人、创业者交流人生如何做选择……...
ArrayList and LinkedList
Unity skframework framework (XIII), question module
【模板】最长公共子序列 (【DP or 贪心】板子)
JS逆向之行行查data解密
Three talking about exception -- error handling
OpenAPI generator: simplify the restful API development process
口袋奇兵点评