See the following screen. It is a part of my application. Anyway, you can see a list there with 4 columns (there could be even more). While I was testing it manually, I noticed it was crashing when I clicked 'last name, first name & organization. Similar listing with sort order options is vastly used in my project. So, what I did, I wrote selenium script.

Project, client name and some necssary information in this image are blurred.
Image-1

 

With very basic knowledge, you can easily record and play by selenium IDE. If you do so, it may look like this:

Selenium IDE script. Project & client name in this image are blurred.
Image-2

 

For a better code management above code can be like this too:

Selenium IDE script. Project & client name in this image are blurred.
Image-3

 

Here you can see that I'm clicking each of the column head and making sure it is landing to correct page. But imagine there could be more columns in a listing. In fact on other pages (in this application) there are many columns than this page. So, it can be done in loop too. In this particular case I've done it the following way:

Selenium IDE script. Project & client name in this image are blurred.
Image-4

 

You may have a question like, in plain script (Image-3) if it crashes, we can easily notice and can know for which one it crashed/failed (see image-5. It becomes red):

Selenium IDE script. Project & client name in this image are blurred.
Image-5

 

But in loop, it would look like image-6. Here you cannot determine for which column it crashed.

Selenium IDE script. Project & client name in this image are blurred.
Image-6

 

I recommend you to install Stored Variable Viewer by Samit Badle. Install it and you'll see a new tab named Stored-Var at bottom panel of selenium IDE. There you can see the variable value and from there you can see for which one it crashed/failed (see image-7, red arrow mark)

Selenium IDE script. Project & client name in this image are blurred.
Image-7

 

Just to show you that it really works, I've intentionally made a typo in ORGANIZATION and after running it it crashed/failed and when I see it in Stored-vars, I can see it like this:

Selenium IDE script. Project & client name in this image are blurred.
Image-8

Comments

masud's picture

Thanks for the post. I've started using loop and while condition in Selenium IDE and it's quite effective. Here is an example

1. storing a javascript array

2. storing ID. This is a checkbox and I need to check if it's checked or NOT checked for certain users

3. WHILE condition where the script loops through the array

4. based on availibility of a text check condition changes. Here I'm storing the TEXT.

5. based on the TEXT stored above, code executed different conditions as specified by GOTOIF command.

Add new comment