当前位置:网站首页>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
边栏推荐
猜你喜欢

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

7月编程排行榜来啦!这次有何新变化?

(2022 Nioke Duo School IV) H-Wall Builder II (Thinking)

PAT serie b write the number 1002

Optional parameters typescript19 - object

UE4 制作遇到的问题

Lawyer Interpretation | Guns or Roses?Talking about Metaverse Interoperability from the Battle of Big Manufacturers

MySQL-Data Definition Language-DDLdatebase define language

state compressed dp

基于Arduino制作非接触式测温仪
随机推荐
High Numbers | 【Re-integration】Line Area Score 880 Examples
MySQL-DML language-database operation language-insert-update-delete-truncate
typescript24-类型推论
类神经网络训练不起来怎么办
移动应用恶意攻击激增500% 三六零天御为APP免费构建安全屏障
(2022 Niu Ke Duo School IV) N-Particle Arts (Thinking)
在沈自所的半年总结
Swastika line-by-line parsing and realization of the Transformer, and German translation practice (a)
MySQL实践总结-
数组问题之《两数之和》以及《三数之和 》
The Flow Of Percona Toolkit pt-table-checksum
mysql中解决存储过程表名通过变量传递的方法
NDK does not contain any platforms问题解决
pytorch、tensorflow对比学习—张量
冲刺金九银十,Android开发面试(内含面试资料|面试题|源码)
(2022牛客多校四)A-Task Computing (排序+动态规划)
USB3.0:VL817Q7-C0的LAYOUT指南(二)
Swastika line-by-line parsing and realization of the Transformer, and German translation practice (2)
LeetCode 27. 移除元素
力扣(LeetCode)212. 单词搜索 II(2022.07.31)