当前位置:网站首页>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
边栏推荐
- 4D line-by-line analysis and implementation of Transformer, and German translation into English (3)
- typescript25-类型断言
- typescript27 - what about enumeration types
- 请求/响应拦截器写法
- LeetCode 1189. “气球” 的最大数量
- Pyspark Machine Learning: Vectors and Common Operations
- 罗技鼠标体验记录
- MySQL Practice Summary -
- typescript26-字面量类型
- typescript20-接口
猜你喜欢

y83.第四章 Prometheus大厂监控体系及实战 -- prometheus告警机制进阶(十四)

USB3.0:VL817Q7-C0的LAYOUT指南(二)

Selenium:弹窗处理

Code Interview Guide for Programmers CD15 Generating an Array of Windowed Maximums

Robot_Framework:常用内置关键字

零序电流继电器器JL-8C-12-2-2

(2022牛客多校四)K-NIO‘s Sword(思维)

万字逐行解析与实现Transformer,并进行德译英实战(一)

pytorch、tensorflow对比学习—功能组件(优化器、评估指标、Module管理)

(2022牛客多校四)D-Jobs (Easy Version)(三维前缀或)
随机推荐
(2022牛客多校四)K-NIO‘s Sword(思维)
pytroch、tensorflow对比学习—搭建模型范式(低阶、中阶、高阶API示例)
MySQL-数据操作-分组查询-连接查询-子查询-分页查询-联合查询
可持久化线段树
Code Interview Guide for Programmers CD15 Generating an Array of Windowed Maximums
ModuleNotFoundError: No module named 'tensorflow.keras' error message solution
Selenium:简介
typescript26 - literal types
Pyspark机器学习:向量及其常用操作
关于给Qt做一个软件初始化的进度条
在沈自所的半年总结
Asynchronous reading and writing of files
Selenium:操作Cookie
万字逐行解析与实现Transformer,并进行德译英实战(二)
力扣(LeetCode)212. 单词搜索 II(2022.07.31)
Selenium:鼠标、键盘事件
RSA主要攻击方法
Progressive Reconstruction of Visual Structure for Image Inpainting 论文笔记
罗技鼠标体验记录
mysql中解决存储过程表名通过变量传递的方法