Friday, June 21, 2013

Storing a value into a variable in Selenium IDE Part 1

1.You can store the value into a variable in Selenium IDE using 'Store' function.

2.   See the doc below:
  store(expression, variableName)
    Arguments:
  • expression - the value to store
  • variableName - the name of a variable in which the result is to be stored.
    This command is a synonym for storeExpression.
Example : 1
 3. Here expression --> 10
       variableName --->a
Finally the store function looks like below     
       store(10, a)
 4. In Selenium IDE how we can do this is   
               



Example 2: store(20,b)




How can we check the variable b value?

By using echo function , displays the b value

    Syntax : ${b}
See results below:



 
Example 3:Storing value of b in to c


Note: Store function internally stores the value of b into an array. If you stored c value, then it place this value into the same array called "storedvars[ ]"


We can call the value of b using "storedvars['b'] instead of ${b}, see the out put below.
Here javascript is used before storedvars['b'] (in target in IDE) for only display purpose, if you want to assign b value to n value no need javascript.



Note 2 :If you don't want to use javascript before your storedvars['b'], just use the storeEval function, Please see below

No comments: