当前位置:网站首页>The 8 element positioning methods of selenium that you have to know are simple and practical
The 8 element positioning methods of selenium that you have to know are simple and practical
2022-07-07 02:42:00 【Xiaowu knock code】
The most basic part of automation belongs to positioning elements , Elements are not positioned , Basically, the regiment has been destroyed , You don't have to think about automation anymore .
Eight positioning methods
Selenium Positioning elements are basically the same as appium The method of locating elements is the same , Here is a test based on Baidu website .
id location
By understanding HTML You can know id It's the only way to say , By looking for id To find
find_element_by_id()
name location
name stay HTML Usually refers to the name of the element
find_element_by_name()
tag location
adopt HTML You can see that tag Define elements of different pages .
find_element_by_tag_name()
class location
adopt HTML come to know class Refers to the class name of the element
find_element_by_class_name()
link_text location
link_text Literally, it is located in the form of text
find_element_by_link_text()
partial_link location
partial_link It belongs to link_text Supplementary positioning method of , Locate some content with long text
find_element_by_partial_link_text()
xpath location
xpath There are many positioning strategies , There are many ways to locate, such as :name,text,class etc. , You can write an article about Xpath Positioning method of
find_element_by_xpath()
Css_selector location
Css It's a language , Usually Css The speed ratio of the positioning method xpath Fast , It's just a little difficult , In reptiles pyquery It is through Css To achieve .
find_element_by_css_selector()
This paper briefly introduces eight positioning methods , You can try it in practice , Write more code , To make the code more proficient .
Finally, thank everyone who reads my article carefully , The following online link is also a very comprehensive one that I spent a few days sorting out , I hope it can also help you in need !

These materials , For those who want to change careers 【 software test 】 For our friends, it should be the most comprehensive and complete war preparation warehouse , This warehouse also accompanied me through the most difficult journey , I hope it can help you ! Everything should be done as soon as possible , Especially in the technology industry , We must improve our technical skills . I hope that's helpful ……
If you don't want to grow up alone , Unable to find the information of the system , The problem is not helped , If you insist on giving up after a few days , You can click the small card below to join our group , We can discuss and exchange , There will be various software testing materials and technical exchanges .
| Click the small card at the end of the document to receive it |
Typing is not easy , If this article is helpful to you , Click a like, collect a hide and pay attention , Give the author an encouragement . It's also convenient for you to find it quickly next time .
Self study recommendation B Stop video :
Zero basis transition software testing : Self taught software testing , Got the byte test post offer, Is the B The best video station !
Advanced automation testing : Huawei has landed , Salary increase 20K,2022 Most suitable for self-study python Automated test tutorial , Spend it yourself 16800 Bought , Free sharing
边栏推荐
- Cloud Mail .NET Edition
- 【软件测试】最全面试问题和回答,全文背熟不拿下offer算我输
- [unity notes] screen coordinates to ugui coordinates
- widerperson数据集转化为YOLO格式
- 如何设计好接口测试用例?教你几个小技巧,轻松稿定
- Halcon instance to opencvsharp (C openCV) implementation -- bottle mouth defect detection (with source code)
- Compress JS code with terser
- 所谓的消费互联网仅仅只是做行业信息的撮合和对接,并不改变产业本身
- Increase 900w+ playback in 1 month! Summarize 2 new trends of top flow qiafan in station B
- How to build a 32core raspberry pie cluster from 0 to 1
猜你喜欢

What are the applications and benefits of MES management system

Linear list --- circular linked list

压缩 js 代码就用 terser
![[Mori city] random talk on GIS data (II)](/img/5a/dfa04e3edee5aa6afa56dfe614d59f.jpg)
[Mori city] random talk on GIS data (II)

用全连接+softmax对图片的feature进行分类

C#/VB. Net to delete watermarks in word documents

MATLB|具有储能的经济调度及机会约束和鲁棒优化

Wireshark installation

Number theory --- fast power, fast power inverse element

fiddler的使用
随机推荐
普通测试年薪15w,测试开发年薪30w+,二者差距在哪?
一本揭秘字节万台节点ClickHouse背后技术实现的白皮书来了!
unity中跟随鼠标浮动的面板,并可以自适应文字内容的大小
用全连接+softmax对图片的feature进行分类
企业中台建设新路径——低代码平台
Gee upgrade can realize one piece of run tasks
Have fun | latest progress of "spacecraft program" activities
Compress JS code with terser
Why am I warned that the 'CMAKE_ TOOLCHAIN_ FILE' variable is not used by the project?
慧通编程入门课程 - 2A闯关
数字滚动增加效果
Detailed explanation of line segment tree (including tested code implementation)
[node learning notes] the chokidar module realizes file monitoring
MATLB|具有储能的经济调度及机会约束和鲁棒优化
leetcode:5. Longest palindrome substring [DP + holding the tail of timeout]
Niuke programming problem -- double pointer of 101 must be brushed
写作系列之contribution
哈希表及完整注释
Use of fiddler
进程管理基础