当前位置:网站首页>Selenium的各类API方法
Selenium的各类API方法
2022-06-29 18:29:00 【是乔乔啊】
文章目录
WebDriver介绍
WebDriver提供很多与浏览器交互的功能和设置。可以通过WebDriver的功能和方法实现与浏览器窗口、警告、框架和弹出窗口的交互。同时也提供了自动化操作浏览器导航栏、设置cookie、截屏等方便测试的特性。
WebDriver功能

WebDriver方法
WebDriver通过方法实现与浏览器窗口、网页和页面元素的交互。



WebElement接口
WebElement可以实现与网站页面元素的交互。包括文本框、文本域、按钮、单选框、多选框、表格、行、列和div等。
WebElement提供了一些功能、属性和方法实现与页面元素的交互。
WebElement功能
| 功能 | 描述 | 实例 |
|---|---|---|
| size | 获取元素的大小 | element.szie |
| tag_name | 获取元素的HTML标签名称 | element.tag_name |
| text | 获取元素的文本值 | element.text |
WebElement方法


Select
WebDriver提供了特定的Select类实现与网页上的列表和下拉菜单的交互。
Select类就是Selenium用于列表和下拉菜单交互的特定类。
Select功能

select方法


Alert
Alert介绍
Alert类可以 操控javaScript警告。Alert包含的方法有接受、驳回、输入和获取警告的文本。
Alert功能

Alert方法

def test_compare_products_removal_alert(self):
alert=self.driver.switch_to_alert()
alert_text=alert.text
self.assertEqual("Are you sure you would like to remove all products from your comparison?", alert_text)
# click on Ok button
alert.accept()
def tearDown(self):
self.driver.quit()
浏览器自动化操作
WebDriver 类提供了以下方法来操控浏览器的后退、前进和刷新等操作。

边栏推荐
- JS text particle dynamic background
- JWT登录验证
- 2022.6.29-----leetcode.535
- [tcapulusdb knowledge base] tcapulusdb operation and maintenance doc introduction
- PostGIS generate graphic cut
- [how the network is connected] Chapter 3 explores hubs, switches and routers
- 源码安装MAVROS
- 如何将OAK相机当做网络摄像头使用?
- 关于微服务
- MySQL enterprise development specification
猜你喜欢

Mac: MySQL 66 questions, 20000 words + 50 pictures!

Data warehouse model layered ODS, DWD, DWM practice

Up to 81.98%! Announcement of undergraduate study rate of more than 100 "double first-class" Universities

Notes on spintronics - zhangshufeng

Adobe Premiere foundation - opacity (mixed mode) (XII)

Travel card "star picking" hot search first! Stimulate the search volume of tourism products to rise

山东大学项目实训(八)设计轮播图进入页面

第八届“互联网+”大赛 | 云原生赛道邀你来挑战

山东大学项目实训(六)点击事件展示折线图

Shandong University project training (VI) Click event display line chart
随机推荐
Shandong University project training (VI) Click event display line chart
Programmer Resource Recommendation Guide
Basis of data analysis -- prediction model
How to use the oak camera on raspberry pie?
RocketMQ的tag过滤和sql过滤
JWT登录验证
Adobe Premiere foundation - opacity (matte) (11)
SD6.24集训总结
data-*属性用法
数据仓库模型分层ODS、DWD、DWM实战
山东大学项目实训(六)点击事件展示折线图
svg画圆路径动画
Redis bloom filter and cuckoo filter
Error [warning] neural network information was performed on socket 'RGB', depth frame is aligned to socket
Cannot retrieve repository metadata processing records
Adobe Premiere foundation - sound adjustment (volume correction, noise reduction, telephone tone, pitch shifter, parameter equalizer) (XVIII)
Notes on spintronics - zhangshufeng
[tcapulusdb knowledge base] tcapulusdb operation and maintenance doc introduction
关于微服务
jdbc_ Related codes