当前位置:网站首页>Selenium: element positioning
Selenium: element positioning
2022-08-01 05:08:00 【Mouse A who is not afraid of cats】
Selenium automated testing
1. Selenium's control of web pages is based on various front-end elements. In the process of use, the positioning of elements is the basis. Subsequent automatic control can only be carried out when the corresponding elements are accurately captured
⑴The previous introductionThe HTML of the front-end web page is composed of many tag elements in a hierarchical structure. For a certain tag, its position in the entire web page HTML is unique. Therefore, this tag element can be accurately found and manipulated by some methods.
⑵ UseThe find_element_by_* function of the WebDriver object can locate a Web page element
⑶ Use the find_elements_by_* function of the WebDriver object to locate multiple Web page elements
2. Automated testing steps: positioning elements -> operating elements -> verifying operation results -> recording test results
Locating a single element
1. When operating the browser, we only need to locate a certain element, so WebDriver provides many methods for locating a single element
2. After using Selenium to open a web page (the return value of the get method), it will return a WebDriver object, which can be usedThe positioning method below to locate an element
3. These methods locate elements through an attribute of the label, so these methods have a unified return value:
⑴ ⑴Find the element: Returns the WebElement object of the corresponding element
⑵Element not found: returns NoSuchElementException
4. After locating an element, we need to perform some operations on this element, which will be used here
边栏推荐
- LeetCode 27. 移除元素
- In the shake database, I want to synchronize the data of the source db0 to the destination db5, how to set the parameters?
- UE4 rays flashed from mouse position detection
- pytorch、tensorflow对比学习—功能组件(激活函数、模型层、损失函数)
- Logitech Mouse Experience Record
- typescript28 - value of enumeration type and data enumeration
- 产品经理访谈 | 第五代验证码的创新与背景
- Selenium:下拉框操作
- Selenium:操作Cookie
- 剑指 Offer 68 - II. 二叉树的最近公共祖先
猜你喜欢
随机推荐
图片更新之后Glide加载依旧是原来的图片问题
这里有110+公开的专业数据集
pytroch、tensorflow对比学习—搭建模型范式(构建模型方法、训练模型范式)
Visual Studio提供的 Command Prompt 到底有啥用
ApiFile
Selenium:操作JS
基于Arduino制作非接触式测温仪
56:第五章:开发admin管理服务:9:开发【文件上传到,MongoDB的GridFS中,接口】;(把文件上传到GridFS的SOP)
pytroch、tensorflow对比学习—搭建模型范式(低阶、中阶、高阶API示例)
Lawyer Interpretation | Guns or Roses?Talking about Metaverse Interoperability from the Battle of Big Manufacturers
USB3.0:VL817Q7-C0的LAYOUT指南(二)
MySQL-数据操作-分组查询-连接查询-子查询-分页查询-联合查询
The method of solving stored procedure table name passing through variable in mysql
SL-12/2过流继电器
初识shell脚本
The Principle Of Percona Toolkit Nibble Algorithm
类神经网络训练不起来怎么办
mysql中解决存储过程表名通过变量传递的方法
Selenium:元素定位
LeetCode 9. 回文数









