当前位置:网站首页>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
边栏推荐
- Li Chi's work and life summary in July 2022
- pytroch、tensorflow对比学习—搭建模型范式(低阶、中阶、高阶API示例)
- pytorch、tensorflow对比学习—功能组件(激活函数、模型层、损失函数)
- typescript26-字面量类型
- Pyspark Machine Learning: Vectors and Common Operations
- safari浏览器怎么导入书签
- [target detection] YOLOv7 theoretical introduction + practical test
- MySQL实践总结-
- pytroch、tensorflow对比学习—专栏介绍
- 剑指 Offer 68 - I. 二叉搜索树的最近公共祖先
猜你喜欢
随机推荐
Lawyer Interpretation | Guns or Roses?Talking about Metaverse Interoperability from the Battle of Big Manufacturers
Progressive Reconstruction of Visual Structure for Image Inpainting 论文笔记
报错:AttributeError: module ‘matplotlib’ has no attribute ‘figure’
用控件当画笔获得bitmap代码记录
Optional parameters typescript19 - object
II. Binary tree to Offer 68 - recent common ancestor
PAT serie b write the number 1002
罗技鼠标体验记录
律师解读 | 枪炮还是玫瑰?从大厂之争谈元宇宙互操作性
力扣(LeetCode)212. 单词搜索 II(2022.07.31)
typescript27 - what about enumeration types
初识shell脚本
LeetCode 387. 字符串中的第一个唯一字符
ApiFile
MySQL-DML language-database operation language-insert-update-delete-truncate
移动应用恶意攻击激增500% 三六零天御为APP免费构建安全屏障
[target detection] YOLOv7 theoretical introduction + practical test
PAT class B 1001 (3n+1) conjecture
2022年超全的Android面经(附含面试题|进阶资料)
Challenge 52 days to memorize Peppa Pig (Day 01)