Learning Resources

Browser and variable access by JavaScript

Storing variables in Selenium IDE

Selenium functions store, storeValue, and storeText store some data for later access.
Selenium uses a map called storedVars to store the data.
You can store strings. Example:

    this text is a string

You can use previously stored variables. ${varaiable_name} gives us access to the storedVars map. Example:

    ${variable1} okay?

* varaible2 will now be ‘this text is a string okay?’
You can use pure javascript expressions. With javascript{} we can use pure javascript:


So you can access the storedVars map directly in a javascript expression:


Storing variables in Selenium IDE
* random_variable and random_variable_copy should be exactly the same.
Note that if you use:

    store 0 zero

zero will be 0, but casted as a string. So later if you use for example:


You will get ’01′ instead of ’1′.
So when you need 0 as an integer you should store your variables using javascript:

    getEval storedVars['zero'] = 0;

* getEval gets the result of evaluating the specified JavaScript snippet.