Selenium IDE - 如何获取verifyNotText的结果并执行正确的操作

时间:2015-04-03 09:51:08

标签: selenium ide command

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

我已经应用了这个

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

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

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

Command: gotoif 
Target:  previous command
Value:   goAhead

你有什么建议吗?

提前谢谢! ç

1 个答案:

答案 0 :(得分:0)

尝试使用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

希望它有所帮助! 如果有任何不清楚的地方,请发表评论