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

高数 | 【重积分】线面积分880例题

华为Android开发面试后得出的面试秘诀

MySQL-DML language-database operation language-insert-update-delete-truncate

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

The difference between scheduleWithFixedDelay and scheduleAtFixedRate

关于给Qt做一个软件初始化的进度条

typescript20-接口

Optional parameters typescript19 - object

7 行代码搞崩溃 B 站,原因令人唏嘘!

(2022牛客多校四)K-NIO‘s Sword(思维)
随机推荐
初识shell脚本
Excel做题记录——整数规划优化模型
II. Binary tree to Offer 68 - recent common ancestor
Robot_Framework:关键字
Visual Studio提供的 Command Prompt 到底有啥用
Selenium:鼠标、键盘事件
LeetCode 9. 回文数
解决ffmpeg使用screen-capture-recorder录屏,有屏幕缩放的情况下录不全的问题
pytorch、tensorflow对比学习—张量
Li Chi's work and life summary in July 2022
typescript27 - what about enumeration types
pytorch、tensorflow对比学习—功能组件(优化器、评估指标、Module管理)
MySQL Practice Summary -
这里有110+公开的专业数据集
25. Have you been asked these three common interview questions?
「以云为核,无感极速」顶象第五代验证码
[target detection] YOLOv7 theoretical introduction + practical test
SL-12/2过流继电器
剑指 Offer 68 - I. 二叉搜索树的最近公共祖先
API设计笔记:pimpl技巧