简体   繁体   English

Selenium IDE使用xpath和index获取元素

[英]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: 我设置以下命令来存储xpath计数:

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

and x="3", which is correct. 和x =“ 3”,这是正确的。 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. 第一行评估为true,而另一行(肯定可见)评估为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]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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