Selenium WebDriver Java Framework Course Limited Time Offer for $20

Selenium WebDriver Java Framework Course Limited Time Offer for $20

 

Print

Selenium IDE Store Commands and Selenium Variables

QA engineers can use Selenium variables functionality to store constants, values passed to test programs from the command-line, from another program or from a file.

 

The plain store command is the most basic of the many store commands and can be used to simply store a constant value in a selenium variable. It takes two parameters, the text value to be stored and a selenium variable. Use the standard variable naming conventions of only alphanumeric characters when choosing a name for your variable.

 

 

CommandTargetValue
store This email address is being protected from spambots. You need JavaScript enabled to view it. userName

Later in the test script, we can use the stored value. To access the value of a variable, enclose the variable in curly brackets ({}) and precede it with a dollar sign like this below.

 

CommandTargetValue
verifyText //div/h3 ${userName}

A common use of variables is for storing input for an input field.

 

ommandTargetValue
type id=login_login_username ${userName}

There are several commands to store:

  • store
  • storeAlert
  • storeAllButtons
  • storeAllFields
  • storeAllLinks
  • storeAllWindowIds
  • storeAllWindowNames
  • storeAttributes