HomeSelenium

New Selenium IDE – Using ‘for each’ commands

New Selenium IDE – Using ‘for each’ commands

Refer the article New Selenium IDE – Commands (Selenese), for the complete list of Selenium IDE commands and their practical demonstrations.

for each is one of the commands in Selenium IDE.

for each is the command in Selenium IDE used for executing a set of same statements multiple times until all the values in the given array (i.e. multiple set of values stored in a single variable) are completed.

Let’s get started.

New Selenium IDE – Using ‘for each’ command

Follow the below steps for practicing for each command in Selenium IDE along with me:

1) Let’s create a test in Selenium IDE for printing the value stored in the array variable until all the elements in the given array variable are completed as shown below:

Command Target Value
open http://omayo.blogspot.com/
execute script return [“Audi”,”Volvo”,”BMW”] x
for each x itr
echo ${itr}
end

After incorporating the commands in the above table, our Selenium IDE should look like below:

for each Selenium IDE - typing

2) Click on ‘Run current test’ option and observe that the test got successfully executed (i.e. The for each block will be executed multiple times until all the values in the array variable x are completed)

Note: The multiple values are stored in the array variable x  are ‘Audi,’Volvo’ and ‘BMW’  (i.e. we have executed JavaScript statement ‘return [“Audi”,”Volvo”,”BMW”]’ as shown above using execute script command, for storing multiple values into the array variable x)

for each Selenium IDE - executed

Here concludes the practical demonstration of for each command in Selenium IDE.

In the next article, I will practically demonstrate another Selenium IDE command.

Next Steps:

  • > Check complete Selenium Tutorial Contents here (Click here)

Please leave your questions/comments/feedback below.

Happy Learning 🙂

About Me > Arun Motoori

On a mission to contribute to the Software Testing Community in all possible ways.

Refer the article New Selenium IDE – Commands (Selenese), for the complete list of Selenium IDE commands and their practical demonstrations.

If you like this article, share it on LinkedIn using the below button:

Comments (1)

  • Hi there Thanks for your tutorials, it helps a lot.

    I have 2 buttons on my web page, How can I store the value of my buttons in an array , then loop through the array?

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *