Selenium IDE: 如果变量包含某些文本

huangapple go评论105阅读模式
英文:

Selenium IDE: If variable contains some text

问题

在Selenium IDE Firefox附加组件中,我正在尝试创建一个条件语句,如果我的变量包含某个文本,则执行一种方式,如果包含其他文本,则执行另一种方式。我遇到的问题是,我需要检查长文本中的一个或两个单词,因此不能使用==。我一直在尝试的是:

Command | Target | Value

Store Value | id = stuff | Test

If | ${Test}.contains('text') |

但这没有起作用。非常感谢您的帮助!

英文:

In the Selenium IDE Firefox add-on I'm trying to create an If statement that will execute a one way if my variable contains a certain text and will execute another way if it contains other text. The issue I'm having is I need it to check just one or two words in a long text so I can't use ==. What I've been trying to do is:

Command | Target | Value

Store Value | id = stuff | Test

If | ${Test}.contains('text') |

But this hasn't been working. Any help with this is greatly appreciated!

答案1

得分: 4

我用这个缩写来处理这种情况。

命令 | 目标 | 值
存储数值 | id = stuff | 测试
执行脚本 | var t = ${Test}; return t.includes('text'); | 临时
如果 | ${tmp}=='true' |
英文:

I use this contraction for such cases.

Command | Target | Value
Store Value | id = stuff | Test
execute script | var t = ${Test}; return t.includes('text'); | tmp
If | ${tmp}=='true' |

huangapple
  • 本文由 发表于 2020年1月7日 00:28:54
  • 转载请务必保留本文链接:https://go.coder-hub.com/59615623.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定