2014-06-30 41 views
0

我试图断言三个元素是可见的。我设置了以下命令来存储xpath计数:Selenium IDE使用xpath和索引获取元素

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

和x =“3”,这是正确的。现在,我想声明所有这三个输入都是可见的。所以我这样做:

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] | 

第一行评估为true,但其他(肯定可见)评估为false。我应该如何正确地对三个输入进行索引?

+4

这个问题已经在http://stackoverflow.com/questions/3369342/cant-get-nth-node-in-selenium –

回答

1

既然您没有发布代码或链接到您正在自动化的页面,我只能猜测。试试这个:

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