当前位置:网站首页>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
边栏推荐
猜你喜欢
随机推荐
In the shake database, I want to synchronize the data of the source db0 to the destination db5, how to set the parameters?
Power button (LeetCode) 212. The word search II (2022.07.31)
Selenium:操作JS
力扣(LeetCode)212. 单词搜索 II(2022.07.31)
pytorch、tensorflow对比学习—功能组件(优化器、评估指标、Module管理)
【目标检测】YOLOv7理论简介+实践测试
Swastika line-by-line parsing and realization of the Transformer, and German translation practice (a)
在沈自所的半年总结
Robot_Framework:断言
C# | 使用Json序列化对象时忽略只读的属性
罗技鼠标体验记录
MySQL-DML语言-数据库操作语言-insert-update-delete-truncate
Selenium:弹窗处理
(2022 Nioke Duo School IV) D-Jobs (Easy Version) (3D prefix or)
typescript23-tuple
Excel做题记录——整数规划优化模型
The Principle Of Percona Toolkit Nibble Algorithm
中国的机器人增长
移动应用恶意攻击激增500% 三六零天御为APP免费构建安全屏障
The difference between scheduleWithFixedDelay and scheduleAtFixedRate









