How can I compare two stored texts and if they are equal to echo some result?
Asked
Active
Viewed 1.8k times
2 Answers
7
You can use the verifyEval
command to compare two variables:
store | text | i
store | different text | j
verifyEval | storedVars['i']==storedVars['j'] | true
Running this script as written will cause the test to fail with [error] Actual value 'false' did not match 'true'
. Change j
to text
, and it will complete without error.
Note that this can also be used to verify that two strings are not equal, by changing true
to false
in the verifyEval
command.

Tetrinity
- 1,105
- 8
- 20
-
This is the right answer. And, it's simple too. Thanks. – SteveSTL Jan 03 '16 at 13:13
-
1this what I dislike about Selenium...well, at least its documentation anyway...verifyEval is no longer available in 3.17...there's no reference as what's the replacement. – Johnny Wu Feb 12 '21 at 16:22
1
As of 3.17 IDE for Chrome:
Command Target Value
assert variableX ${variableY}
IMPORANT: the target does NOT need ${}...or you'll get a null

Johnny Wu
- 1,297
- 15
- 31