I would use a slightly simpler expression, assuming you do not need to handle things like 1 second
, 2 seconds
, etc, but only need to handle things like 1 second(s)
or 2 second(s)
, you could use this expression:
try replacing the regex stuff with
[0-9]+ [a-z]+\(s\)
Some older regex flavors (POSIX ERE) don't allow the shorthand character classes, so if those rules are somehow being invoked, then it would fail on \s
and \w
(and maybe even the .
). The above expression should work almost anywhere; though it is not as flexible, it should be flexible enough for your situation.
Some flavors that are even older (POSIX BRE) don't support the shorthand repetition and actually interpret curly braces and parentheses differently as well. If that is the flavor being expected, it might just fail on any normal expression, and you'd need to usde something like:
[0-9]\{1,\} [a-z]\{1,\}(s)
If neither of these work, then there is a significant difference in the engines implementing your regex OR there is some difference in how the page is rendering and being parsed/searched/analyzed by the Selenium Server.
If that is the case, there could be <br>
tags or formatting tags (like <i>
or <span>
) that are being parsed as text rather than being extracted from the string. Then, something like changes are fully visible
might be parsed as changes are <em>fully</em> visible
and thus failing the test