Storing Selenium IDE Variables

With Selenium IDE it is possible to store variables.
These variables can then be used in later commands during the same test flow.

How to store a variable

To store a variable during a test, please use the store command:

store - javascript(return "test" + Math.floor(Math.random()*11111) + "@test.com") - emailAddress

This example will store a variable called emailAddress and its value will be a random "test....@test.com" string.

Storing a variable happens in the context of the page. You can use any kind of javascript and reference DOM elements or other functions available on the page. The return value is stored.

How to use a variable

Once you have stored a variable, you can use it in subsequent steps like this: ${emailAddress}


Below are some examples on how to store and use variables.

storeText("css=.container:nth-child(1) > span:nth-child(3)","myVar")

This will store the text from element with CSS selector .container:nth-child(1) > span:nth-child(3) in a variable called myVar.


This will type the text stored in the myVar variable to an element with ID=inputField