【问题标题】:Selenium IDE - how to get result of verifyNotText and do the right actionSelenium IDE - 如何获取 verifyNotText 的结果并执行正确的操作
【发布时间】:2015-04-03 09:51:07
【问题描述】:

我正在使用 Selenium IDE,我只能使用该工具。 我有这种情况:我检查我的邮箱是否包含消息。 唯一的办法就是检查页面上是否有某个字符串。

我已经应用了这个

Command: verifyNotText
Target: //form[@id='messages']/table/tbody/tr/td[5]
Value: "on behalf of:.*"

如何检查该命令的结果? 我的意思是:如果结果为真,测试将继续执行命令列表, 相反,它应该执行其他命令。

我正在考虑使用类似的东西:

Command: gotoif 
Target:  previous command
Value:   goAhead

你有什么建议吗?

提前感谢您! C

【问题讨论】:

    标签: selenium ide command


    【解决方案1】:

    尝试使用storeTextPresent。如果你想使用gotoIf函数,你需要一个变量。

    storeTextPresent on behalf of:.* text //text is a variable name
    gotoIf ${text}==on behalf of:.* Yes //Yes and No are labels
    gotoIf ${text}!=on behalf of:.* No
    label Yes 
    //instructions if text present equals "on behalf of:.*"
    goto End
    label No
    //instructions if text present not equals "on behalf of:.*"
    

    另一个有用的东西可能是使用goto 函数。如果您想跳转到特定步骤,您可以使用此功能“驱动”您的测试。 示例:

    goto End //jump to label End
    label End
    

    希望对您有所帮助! 有什么不明白的,欢迎留言

    【讨论】:

    • 谢谢 Rafal,正是我需要的 :)
    猜你喜欢
    • 1970-01-01
    • 2019-04-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-08-09
    • 2020-12-09
    • 2020-03-25
    • 1970-01-01
    相关资源
    最近更新 更多