There is got to be more to life than just play, pause and stop on the land of Magic Meadows! Welcome back to another interesting post on Selenium IDE!
Customizing the default timeout value – What is that good for? Hmmm, let us see…
Not everything on web happens as we wish (If so, life would be so much better). There are times when a particular web element on the web page appears slower than expected i.e. becomes accessible at a slower pace. And this might result in an error while playing back our automated test cases and stop execution once for all. This is not what we wished for!
Instead, we would want Selenium IDE to wait a teeny weeny bit longer i.e. until our web elements become accessible in such cases.
To our rescue comes, the Default Timeout Value option present in the ‘General’ tab of the Options menu, which can be altered.
This value as highlighted in the above image represents the time in milliseconds that the Selenium IDE would prefer to wait for a test step execution before generating an error. Getting hard-core, the request was sent to the server but that nothing came back in 30 seconds as the default value is set to 30000ms i.e. 30s. This value can be increased or decreased appropriately to suit our needs. Thus timeout errors overcome! Hurray!!!
BrainBell – Practice! Yes, this bit is important. Don’t just keep staring at your screen. Type and execute some test scenarios. If I do everything for you, then your brain’s health is not going to be great for long. So gear up and get on to those bumpy roads ahead!
Next up: How do breakpoints work? Inquiring minds might wish to know…
In a test case, we might want to make changes after a particular test step or identify which command (black sheep I say) is actually causing the error and thus leading to test case failure.
Toggle Breakpoint present in the Actions menu empowers us to accomplish our goals by making the complex simple.
Toggle, which means if the breakpoint exists already, clicking ‘Toggle Breakpoint’ will remove it and vice versa (Just like how our Caps lock key toggles between two modes). Thus, a breakpoint will either be inserted or removed from the selected command based on its existing state.
So, we can have multiple breakpoints to pause the execution at desired steps in a single test case. This can be achieved in the following ways,
- Right click on particular command and select ‘Toggle Breakpoint’ option.
2. Select the required command and press ‘b’ or ‘B’ (Shortcut key) for the same.
3. Select the desired command; click ‘Options’ menu and select ‘Toggle Breakpoint’.
Once the execution reaches the command with the breakpoint and pauses for us to make a move, we again have 2 options,
- Resume the execution by clicking on ‘Pause / Resume’ button in the toolbar as shown in the above image Or,
- Step through/execute succeeding commands one at a time, to see what exactly each command does by clicking the ‘Step’ button and find which one is causing the error if any.
I agree that this ‘step’ is a pretty awesome feature and comes handy when we have to do some serious debugging! So I have dedicated the upcoming post entirely to this same topic.
Next up: Set / Clear Start Point, This is an indicator that tells Selenium IDE the command at which the execution has to start.
We might want to repeat the execution for a small set of test steps in a real big test case. Running the entire test case would be a waste of many resources. In such situations, we can set a start point in a couple of ways,
- Right click on the command where the start point has to be set and select ‘Set / Clear Start Point’.
- Select the particular command and press ‘s’ or ‘S’ (shortcut key) for the same.
In the above shown example, playback will start execution from third line. It is important to note that there is a dependency on Firefox browser’s currently displayed page. The test case will fail at the start point if you are on the wrong page for the chosen command to execute. Also, there can only be one start point per test case.
In order to clear the start point that is being set, select the command with the start point and use the shortcut key ‘S’ or right click and select ‘Set / Clear Start Point’ option.
With this knowledge, I let you free to continue with today’s BrainBell! Yep, practice all that we just discussed and I will be back with yet another post on Selenium IDE.
Have a great day!<< 7h. Selenium IDE – A glance on the Selenium commands 7j. Selenium IDE – Debugging >>