英文:
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' |
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论