简体   繁体   中英

Selenium IDE get element using xpath and index

I am trying to assert that three elements are visible. I set up the following command to store the xpath count:

storeXpathCount | xpath=//input[contains(@class,"k-formatted-value") and contains(@class, "call-timer-editor")] | x

and x="3", which is correct. Now, I want to assert that all three of those inputs are visible. so I do:

verifyVisible | xpath=//input[contains(@class,"k-formatted-value") and contains(@class, "call-timer-editor")][1] | 
verifyVisible | xpath=//input[contains(@class,"k-formatted-value") and contains(@class, "call-timer-editor")][2] | 
verifyVisible | xpath=//input[contains(@class,"k-formatted-value") and contains(@class, "call-timer-editor")][3] |

The first line evaluates to true, but the other (which are for sure visible) evaluate to false. How should I correctly index to the three inputs?

Since you did not post code or link to the page you are automating I can only guess. Try this:

xpath=(//input[contains(@class,"k-formatted-value") and contains(@class, "call-timer-editor")])[2]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM