当前位置:网站首页>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,‘_’)]”)
边栏推荐
- 刷题《剑指Offer》day01
- Sqlserver has opened the CDC table. Why can we only pull the full amount of data and can't recognize the incremental data
- Chapter 3 business function development (realize the real-time response of the select all button)
- Raspberrypico serial communication
- [dark horse programmer] redis learning notes 005: enterprise level solutions
- A simple SQL injection shooting range exercise
- 第3章业务功能开发(实现全选按钮实时的响应)
- TCGA simple download tool V16 installation error
- RTOS series (13): assembly LDR instruction, LDR pseudo instruction, [rn] register indirect reference detailed analysis
- 哈希表刷题(上)
猜你喜欢

Use of lambdaquerywrapper, lambdaupdatewrapper, lambdaquerychainwrapper

Redis最佳实践

@Use of data annotation (instead of get and set methods in entity classes)

475-82(230、43、78、79、213、198、1143)

Redis分片集群

Idea2021 failed to start. Could not find main class com/intellij/idea/main

Huawei device remote login (Telnet, SSH) configuration

Record the process of two multi terminal troubleshooting

【黑马程序员】Redis学习笔记004:主从复制+哨兵模式+集群

Rk3399 development board i2c4 attaching EEPROM instance
随机推荐
Machine learning theory and case analysis (Part1) -- Fundamentals of machine learning
Recursive call to print every bit of an integer
Refreshing mobile terminal personal center page
Svg creative underline style JS special effect
@Feignclient annotated interface. You may not get instances with @autowired
FreeMaker模板引擎
The database of idea cannot prompt the table name, field name, and schema cannot be loaded
[Sesame Street family] & Bert Bart Roberta
Review the second time, 220614, video, day03_ Data warehouse design,
Raspberrypico analytic PWM
Bigdecimel in words
CAS operation
Mogdb 3.0 how to add a standby database in the environment of one active and one standby
Learn no when playing 8 | the enterprise saves hundreds of thousands in an instant, just because it uses it
Interview questions: common faults and occurrence scenarios of redis
【黑马程序员】Redis学习笔记004:主从复制+哨兵模式+集群
文献学习(part101)--CONVEX BICLUSTERING
SSM+JSP+MYSQL实现的宠物领养收养管理系统源码
Enq: HW - fault analysis caused by content waiting
Online shopping E-commerce mall system based on jsp+servlet+mysql+