当前位置:网站首页>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
边栏推荐
- typescript25 - type assertion
- LeetCode 1189. “气球” 的最大数量
- FFmpeg 搭建本地屏幕录制环境
- [target detection] YOLOv7 theoretical introduction + practical test
- Robot_Framework:常用内置关键字
- pytorch、tensorflow对比学习—功能组件(优化器、评估指标、Module管理)
- MySQL-DML language-database operation language-insert-update-delete-truncate
- 挑战52天背完小猪佩奇(第01天)
- pytroch、tensorflow对比学习—使用GPU训练模型
- JWL-11/2-99.9A电流继电器
猜你喜欢
冲刺金九银十,Android开发面试(内含面试资料|面试题|源码)
typescript26-字面量类型
(2022 Nioke Duo School IV) H-Wall Builder II (Thinking)
7 行代码搞崩溃 B 站,原因令人唏嘘!
Excel做题记录——整数规划优化模型
(2022牛客多校四)D-Jobs (Easy Version)(三维前缀或)
Lawyer Interpretation | Guns or Roses?Talking about Metaverse Interoperability from the Battle of Big Manufacturers
干货!如何使用仪表构造SRv6-TE性能测试环境
pytorch、tensorflow对比学习—计算图和微分机制
基于Arduino制作非接触式测温仪
随机推荐
Lawyer Interpretation | Guns or Roses?Talking about Metaverse Interoperability from the Battle of Big Manufacturers
请问表格储存中用sql只能查询到主键列,ots sql非主键不支持吗?
冲刺金九银十,Android开发面试(内含面试资料|面试题|源码)
Selenium:元素等待
Selenium:简介
Progressive Reconstruction of Visual Structure for Image Inpainting 论文笔记
(2022牛客多校四)H-Wall Builder II(思维)
(more than 2022 cattle school four) A - Task Computing + dynamic programming (sort)
typescript25-类型断言
Selenium:下拉框操作
pytroch、tensorflow对比学习—搭建模型范式(构建模型方法、训练模型范式)
Li Chi's work and life summary in July 2022
typescript27 - what about enumeration types
vim配置+ctag像source insight一样方便阅读代码
High Numbers | 【Re-integration】Line Area Score 880 Examples
Pyspark Machine Learning: Vectors and Common Operations
6-23漏洞利用-postgresql代码执行利用
备战金九银十,如何顺利通过互联网大厂Android的笔面试?
华为Android开发面试后得出的面试秘诀
(2022牛客多校四)D-Jobs (Easy Version)(三维前缀或)