【问题标题】:Selenium IDE get element using xpath and indexSelenium IDE 使用 xpath 和索引获取元素
【发布时间】:2014-08-21 08:55:33
【问题描述】:

我试图断言三个元素是可见的。我设置了以下命令来存储 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] |

第一行计算结果为真,但另一行(肯定可见)计算结果为假。我应该如何正确索引三个输入?

【问题讨论】:

标签: testing xpath indexing automated-tests selenium-ide


【解决方案1】:

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

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-08-05
    • 1970-01-01
    • 2021-05-02
    • 1970-01-01
    相关资源
    最近更新 更多