当前位置:网站首页>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
边栏推荐
- Swastika line-by-line parsing and realization of the Transformer, and German translation practice (2)
- 在沈自所的半年总结
- 7月编程排行榜来啦!这次有何新变化?
- Excel做题记录——整数规划优化模型
- Selenium:鼠标、键盘事件
- I met a shell script
- MySQL实践总结-
- Error: AttributeError: module 'matplotlib' has no attribute 'figure'
- typescript28 - value of enumeration type and data enumeration
- Pyspark Machine Learning: Vectors and Common Operations
猜你喜欢
随机推荐
6-23漏洞利用-postgresql代码执行利用
请求/响应拦截器写法
MySQL Practice Summary -
可持久化线段树
MySQL实践总结-
(2022牛客多校四)D-Jobs (Easy Version)(三维前缀或)
力扣(LeetCode)212. 单词搜索 II(2022.07.31)
FFmpeg 搭建本地屏幕录制环境
「以云为核,无感极速」顶象第五代验证码
safari浏览器怎么导入书签
ModuleNotFoundError: No module named ‘tensorflow.keras‘报错信息的解决方法
剑指 Offer 68 - I. 二叉搜索树的最近公共祖先
25. Have you been asked these three common interview questions?
(2022牛客多校四)N-Particle Arts(思维)
产品经理访谈 | 第五代验证码的创新与背景
[MySQL] 多表查询
风险策略调优中重要的三步分析法
typescript23-tuple
RSA主要攻击方法
The difference between scheduleWithFixedDelay and scheduleAtFixedRate









