selenium-ide

Selenium IDE: If variable contains some 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!


Solution

  • 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' |