当前位置:网站首页>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. 移除元素
- Selenium:下拉框操作
- typescript27 - what about enumeration types
- (2022 Niu Ke Duo School IV) K-NIO's Sword (Thinking)
- HJS-DE1/2时间继电器
- MySQL-DML语言-数据库操作语言-insert-update-delete-truncate
- (2022牛客多校四)N-Particle Arts(思维)
- Selenium:操作JS
- 4D line-by-line analysis and implementation of Transformer, and German translation into English (3)
- 冲刺金九银十,Android开发面试(内含面试资料|面试题|源码)
猜你喜欢
高数 | 【重积分】线面积分880例题
USB3.0:VL817Q7-C0的LAYOUT指南(二)
Lawyer Interpretation | Guns or Roses?Talking about Metaverse Interoperability from the Battle of Big Manufacturers
(more than 2022 cattle school four) A - Task Computing + dynamic programming (sort)
(2022牛客多校四)A-Task Computing (排序+动态规划)
typescript28 - value of enumeration type and data enumeration
UE4 制作遇到的问题
Power button (LeetCode) 212. The word search II (2022.07.31)
The difference between scheduleWithFixedDelay and scheduleAtFixedRate
Robot_Framework:关键字
随机推荐
MySQL-Data Operation-Group Query-Join Query-Subquery-Pagination Query-Joint Query
PAT乙级 1001 害死人不偿命的(3n+1)猜想
25. 这三道常见的面试题,你有被问过吗?
Lawyer Interpretation | Guns or Roses?Talking about Metaverse Interoperability from the Battle of Big Manufacturers
李迟2022年7月工作生活总结
LeetCode 387. 字符串中的第一个唯一字符
typescript21 - Comparison of Interfaces and Type Aliases
状态压缩dp
请求/响应拦截器写法
[target detection] YOLOv7 theoretical introduction + practical test
MySQL-DML语言-数据库操作语言-insert-update-delete-truncate
零序电流继电器器JL-8C-12-2-2
剑指 Offer 68 - I. 二叉搜索树的最近公共祖先
state compressed dp
Li Chi's work and life summary in July 2022
类神经网络训练不起来怎么办
备战金九银十,如何顺利通过互联网大厂Android的笔面试?
pytorch、tensorflow对比学习—功能组件(优化器、评估指标、Module管理)
(2022牛客多校四)N-Particle Arts(思维)
请问shake数据库中为什么读取100个collection 后,直接就退出了,不继续读了呢?