Monday, 7 May 2012

Using variables with Seleium IDE

Testing part of the application I work on involves filling out a fairly long registration form. I've been using Selenium IDE to make my life easier but I still have to change a few fields before I can submit the form. I.e. Email and username, because they must be unique. I normally add an ever increasing number to the end of the fields which doesn't take long but it annoys me that I still have manual steps. So I wondered if it is possible to use variables in the test script. Turns out it is. 

The 'store' command saves a variable. Confusingly, for me at least, the 'target' is the variable value and the 'value' is the name of the variable. Once the variable is declared it can be used to populate other fields using the syntax ${variableName}.


The image below shows an example. I've created a variable called testNumber which is used to populate the Email, EmailConfirm and Username fields with unique values.


 

No comments:

Post a Comment