With Selenium IDE, how can I test if an element's inner text contains a specific string? For example:
<p id="fred">abcde</p>
'id=fred' contains "bcd" = true)
With Selenium IDE, how can I test if an element's inner text contains a specific string? For example:
<p id="fred">abcde</p>
'id=fred' contains "bcd" = true)
Are you able to use jQuery if so try something like
You can also use:
It can be done with a simple wildcard:
See selenium IDE Doc
The Selenium-IDE documentation is helpful in this situation.
The command you are looking for is
assertText
, the locator would beid=fred
and the text for example*bcd*
.You can use the command
assertTextPresent
orverifyText
It seems regular expressions might work:
(From site: http://www.grymoire.com/Unix/Regular.html)
If you are using visual studio there is functionality for evaluating strings with regular expressions of ALL kinds (not just contains):
The expression I posted will check if the string contains ONLY letters.
Your regular expression would then according to my link be "bcd" or some string you construct at runtime. Or:
(Something like that anyway)
Hope it helped.