当前位置:网站首页>Various API methods of selenium
Various API methods of selenium
2022-06-29 18:57:00 【It's Joe Joe】
List of articles
WebDriver Introduce
WebDriver Provide many with Browser interaction Functions and settings of . Can pass WebDriver The functions and methods are implemented with the browser window 、 Warning 、 Interaction between frame and pop-up window . At the same time, it also provides the navigation bar of the browser for automatic operation 、 Set up cookie、 Screen capture and other features convenient for testing .
WebDriver function

WebDriver Method
WebDriver Through the method to realize the connection with the browser window 、 Interaction between web pages and page elements .



WebElement Interface
WebElement Can be achieved with the website Page elements Interaction . Include text box 、 Text domain 、 Button 、 Radio buttons 、 Checkbox 、 form 、 That's ok 、 Column sum div etc. .
WebElement Provided some function 、 attribute and Method Realize the interaction with page elements .
WebElement function
| function | describe | example |
|---|---|---|
| size | Get the size of the element | element.szie |
| tag_name | Fetch element HTML Tag name | element.tag_name |
| text | Gets the text value of the element | element.text |
WebElement Method


Select
WebDriver Provides specific Select Class implementation and... On Web pages list and The drop-down menu Interaction .
Select Class is Selenium Specific classes for list and drop-down menu interaction .
Select function

select Method


Alert
Alert Introduce
Alert Classes can be Manipulation javaScript Warning .Alert Included methods are acceptance 、 rejected 、 Enter and get the text of the warning .
Alert function

Alert Method

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()
Browser automation
WebDriver Class provides the following methods to manipulate the browser's backward 、 Forward and refresh .

边栏推荐
- Adobe Premiere foundation - opacity (mixed mode) (XII)
- 74. maximum profit on shares
- JS-判断数组键名是否存在
- Data-* attribute usage
- The table ‘table_ Name 'is full exception troubleshooting and solution
- SD6.24集训总结
- JWT login authentication
- layer. prompt
- 75. nearest common ancestor of binary search tree
- How to use the low code platform of the Internet of things for service management?
猜你喜欢

Anaconda安装并配置jupyter notebook远程

熊猫跑酷js小游戏代码

Machine learning 7-Support vector machine

Data warehouse model layered ODS, DWD, DWM practice

Machine learning 8-artificial neural network

How to use the low code platform of the Internet of things for service management?

The 8th "Internet +" competition - cloud native track invites you to challenge
![[Nanjing University] information sharing of the first and second postgraduate entrance examinations](/img/0d/a6392e6b92bb689e90c038ffac9dd8.jpg)
[Nanjing University] information sharing of the first and second postgraduate entrance examinations

Anfulai embedded weekly report no. 271: June 20, 2022 to June 26, 2022

76.二叉树的最近公共祖先
随机推荐
Anaconda installs and configures jupyter notebook remote
The table ‘table_ Name 'is full exception troubleshooting and solution
TP5 where queries whether a field in the database contains a value. Fuzzy queries are performed without the like method
数据仓库模型分层ODS、DWD、DWM实战
Sd6.22 summary of intensive training
山东大学项目实训(八)设计轮播图进入页面
2022.6.29-----leetcode.535
Chapter 02_ MySQL data directory
2. 在STM32CubeMX建立的Keil5工程中添加自定义的相关文件
产品-Axure9(英文版),中继器(Repeater)实现表格内容的增删查改(CRUD)
SD6.23集训总结
Redis (I) -- getting started with redis (2) -- redis data type
JS judge whether the array key name exists
山东大学项目实训(七)添加导航栏选择城市
Elegant writing controller (parameter verification + unified exception handling)
js文本粒子动态背景
SD6.22集训总结
Seven cattle image access parameters (thumbnails are small in size to avoid wasting traffic)
龙canvas动画
Adobe Premiere foundation - time remapping (10)