Comparing stored variables


#1

So, how do you compare two stored variables to confirm they match? In the old Selenium IDE, I would use verifyEval | storedVars.var1==storedVars.var2 | true. But it looks like verifyEval no longer exists?

I’m pulling a set of values from a csv and then storing values in web forms to be able to verify that the values in the web page match the variables stored from the csv. In some cases, I can simply verifyValue = ${variable}, but in others, such as dates, which are actually split across three fields, I have store the values then concatenate into a variable to compare to the variable from the csv.


#2

You can use the if command plus ThrowError instead:

if  | !(storedVars['var1']==storedVars['var2'])
 ThrowError | "Variables do not match"
EndIf

These 3 lines are a direct and more flexible replacement for verifyEval.

Note that instead of

if | !(storedVars['var1']==storedVars['var2'])

This should also work:

if | !("${var1}" == ${var2}")


Comparing 2 columns and see which one is greater in an if statement
#3

I also would use something like that:
storeEval | ${var1} == ${var2} | GLOBAL_EQUAL