当前位置:网站首页>Foundation 31: Selenium positioning dynamic ID element
Foundation 31: Selenium positioning dynamic ID element
2022-07-25 08:32:00 【False face】
One . We often encounter elements that need to be located id Not fixed , Unable to get id Positioning

Two . Because of this element id Is dynamic , Unable to get id Property to locate , I had to change to xpath
1. Positioning by absolute path
By.xpath(“/html/body/div[3]/div[2]/div/form/div/div[5]/div/div[3]/div/div[3]/div/div/span/input[9]”)---- Unable to locate
2. Locate by element index
By.xpath(“//input[9]”)— Successful positioning
3. Use xpath Attribute positioning
By.xpath(“//input[@id=‘kw1’]”)
By.xpath(“//input[@type=‘name’ and @name=‘kw1’]”)
4. Use partial property value matching
By.xpath("//input[starts-with(@id,‘file’)
By.xpath("//input[ends-with(@id,‘_11’)
By.xpath(“//input[contains(@id,‘_’)]”)
边栏推荐
- Test the mock data method of knowing and knowing
- @Autowired注解的实现原理
- efcore在Saas系统下多租户零脚本分表分库读写分离解决方案
- [dark horse programmer] redis learning notes 004: master-slave replication + sentinel mode + cluster
- 【5G NR】UE注册拒绝原因
- Redis最佳实践
- @Autowired的使用
- 第3章业务功能开发(查询线索)
- @Implementation principle of Autowired annotation
- @Autowired注解的原理
猜你喜欢

Recursive call to print every bit of an integer

【黑马程序员】Redis学习笔记001:Redis简介+五种基本数据类型

Redis学习

Online bookstore system based on jsp+servlet+mysql

Network solutions for Alibaba cloud services

Chapter 3 business function development (realize the real-time response of the select all button)

第3章业务功能开发(实现全选按钮实时的响应)

NVIDIA programmable reasoning accelerator tensorrt learning notes (II) - practical operation

CAS operation
![[ten thousand words long text] Based on LSM tree thought Net 6.0 C # realize kV database (case version)](/img/07/235785b7658b5ae022dfa3f53ec86d.png)
[ten thousand words long text] Based on LSM tree thought Net 6.0 C # realize kV database (case version)
随机推荐
Idea starts the project slowly
【5G NR】UE注册拒绝原因
[dark horse programmer] redis learning notes 004: master-slave replication + sentinel mode + cluster
Raspberry pie uses the command line to configure WiFi connections
nuscenes数据集3D MOT demo,端到端的目标检测和跟踪,检测跟踪联合框架
@The difference and use of value and configurationproperties
Machine learning theory and case analysis (Part1) -- Fundamentals of machine learning
Idea failed to start the project yamlexception Chinese file encoding format
Surpassing transformer, Tsinghua, byte significantly refresh parallel text generation SOTA performance | ICML 2022
CAS operation
One of C language multithreading programming
Common commands of raspberry pie
C # introductory series (30) -- exception handling
技术面②Mysql中的索引(index)类型有哪些并简要介绍一下?什么时候需要创建索引?什么时候不需要创建索引?为什么创建索引后查询速度会提高?
Redis learning
Svg creative underline style JS special effect
第3章业务功能开发(实现全选按钮实时的响应)
[shader realizes shadow projection effect _shader effect Chapter 8]
Refreshing mobile terminal personal center page
Deduct one question every day - 2114. The maximum number of words in the sentence