Stanimir Yakimov
Stanimir Yakimov

Reputation: 884

How can I compare two stored texts in Selenium IDE?

How can I compare two stored texts and if they are equal to echo some result?

Upvotes: 5

Views: 18833

Answers (2)

Johnny Wu
Johnny Wu

Reputation: 1518

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

Upvotes: 1

Tetrinity
Tetrinity

Reputation: 1105

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.

Upvotes: 7

Related Questions