Sequence of Evaluation and Flow Control – while loop in selenium IDE

Lets see first what is while LOOP. Check out this image.

How while loop works?

How while loop works?

This person do pushups till he will tired.

While (not tired){

Do push ups

}

Now before we moving forward to know other things we have see User Extensions in selenium IDE.

We can see a dropdown of commands in command field of Selenium IDE. This all commands are JavaScript functions. Selenium’s core being written in JavaScript as well.

So we can make our on JavaScript add-ons or User extensions to new functionality to Selenium IDE.

One good thing is that most of the most needed functionality have already been developed as selenium IDE user extentions.
Please check out the FlowControl extension – goto_sel_ide.js and checkout the Author’s portal as well 51 Elliot

Before we moving forward lets see How to include user extensions in selenium IDE?

  1. Start Firefox
  2. open Selenium IDE
  3. Go to Selenium IDE menu Options
  4. Select General tab
  5. Go to Selenium Core extensions and browse path of .js file from computer drive.

Please restart Selenium IDE to make effect of new added commands using user extension file.

How to include user extensions in selenium IDE?

How to include user extensions in selenium IDE?

So we have goto_sel_ide.js means we have following commands capability on our Selenium IDE.

Commands
label | mylabel – creates a label called “mylabel” (a goto target)
goto | mylabel – goto “mylabel”
gotoLabel | mylabel – synonym for goto
gotoIf | expression – jump to specified label if expression is true
while | expression – loop while expression is true
endWhile – indicate the end of a while loop

We can verify this by typing into command field of selenium IDE.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Now it time to use Sequence of Evaluation and Flow Control – while loop in Selenium IDE…………… 🙂

How? check out following image

Sequence of Evaluation and Flow Control - while loop

Sequence of Evaluation and Flow Control – while loop

 

 

 

 

 

 

 

 

 

 

 

 

OR copy paste following html into Source tab of Selenium IDE. OR take code from PasteBin

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head profile="http://selenium-ide.openqa.org/profiles/test-case">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="selenium.base" href="http://demo.opensourcecms.com/" />
<title>whileTest</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3">whileTest</td></tr>
</thead><tbody>
<tr>
 <td>store</td>
 <td>10</td>
 <td>var1</td>
</tr>
<tr>
 <td>while</td>
 <td>${var1} &lt; 20</td>
 <td></td>
</tr>
<tr>
 <td>echo</td>
 <td>Value of var1 is ${var1}</td>
 <td></td>
</tr>
<tr>
 <td>storeEval</td>
 <td>new Number(storedVars['var1']) + 1</td>
 <td>var1</td>
</tr>
<tr>
 <td>endWhile</td>
 <td></td>
 <td></td>
</tr>
</tbody></table>
</body>
</html>

 

The output of the code execution taken from Selenium IDE LOG.

 [info] Executing: |store | 10 | var1 |
 [info] Executing: |while | ${var1} < 20 | |
 [info] Executing: |echo | Value of var1 is ${var1} | |
 [info] echo: Value of var1 is 10
 [info] Executing: |storeEval | new Number(storedVars['var1']) + 1 | var1 |
 [info] script is: new Number(storedVars['var1']) + 1
 [info] Executing: |endWhile | | |
 [info] Executing: |while | ${var1} < 20 | |
 [info] Executing: |echo | Value of var1 is ${var1} | |
 [info] echo: Value of var1 is 11
 [info] Executing: |storeEval | new Number(storedVars['var1']) + 1 | var1 |
 [info] script is: new Number(storedVars['var1']) + 1
 [info] Executing: |endWhile | | |
 [info] Executing: |while | ${var1} < 20 | |
 [info] Executing: |echo | Value of var1 is ${var1} | |
 [info] echo: Value of var1 is 12
 [info] Executing: |storeEval | new Number(storedVars['var1']) + 1 | var1 |
 [info] script is: new Number(storedVars['var1']) + 1
 [info] Executing: |endWhile | | |
 [info] Executing: |while | ${var1} < 20 | |
 [info] Executing: |echo | Value of var1 is ${var1} | |
 [info] echo: Value of var1 is 13
 [info] Executing: |storeEval | new Number(storedVars['var1']) + 1 | var1 |
 [info] script is: new Number(storedVars['var1']) + 1
 [info] Executing: |endWhile | | |
 [info] Executing: |while | ${var1} < 20 | |
 [info] Executing: |echo | Value of var1 is ${var1} | |
 [info] echo: Value of var1 is 14
 [info] Executing: |storeEval | new Number(storedVars['var1']) + 1 | var1 |
 [info] script is: new Number(storedVars['var1']) + 1
 [info] Executing: |endWhile | | |
 [info] Executing: |while | ${var1} < 20 | |
 [info] Executing: |echo | Value of var1 is ${var1} | |
 [info] echo: Value of var1 is 15
 [info] Executing: |storeEval | new Number(storedVars['var1']) + 1 | var1 |
 [info] script is: new Number(storedVars['var1']) + 1
 [info] Executing: |endWhile | | |
 [info] Executing: |while | ${var1} < 20 | |
 [info] Executing: |echo | Value of var1 is ${var1} | |
 [info] echo: Value of var1 is 16
 [info] Executing: |storeEval | new Number(storedVars['var1']) + 1 | var1 |
 [info] script is: new Number(storedVars['var1']) + 1
 [info] Executing: |endWhile | | |
 [info] Executing: |while | ${var1} < 20 | |
 [info] Executing: |echo | Value of var1 is ${var1} | |
 [info] echo: Value of var1 is 17
 [info] Executing: |storeEval | new Number(storedVars['var1']) + 1 | var1 |
 [info] script is: new Number(storedVars['var1']) + 1
 [info] Executing: |endWhile | | |
 [info] Executing: |while | ${var1} < 20 | |
 [info] Executing: |echo | Value of var1 is ${var1} | |
 [info] echo: Value of var1 is 18
 [info] Executing: |storeEval | new Number(storedVars['var1']) + 1 | var1 |
 [info] script is: new Number(storedVars['var1']) + 1
 [info] Executing: |endWhile | | |
 [info] Executing: |while | ${var1} < 20 | |
 [info] Executing: |echo | Value of var1 is ${var1} | |
 [info] echo: Value of var1 is 19
 [info] Executing: |storeEval | new Number(storedVars['var1']) + 1 | var1 |
 [info] script is: new Number(storedVars['var1']) + 1
 [info] Executing: |endWhile | | |
 [info] Executing: |while | ${var1} < 20 | |

 

 

 

 

 

 

 

 

 

 

Advertisements
Pupunzi

For a better web

Tech

News and reviews from the world of gadgets, gear, apps and the web

VentureBeat

News About Tech, Money and Innovation

Digital Inspiration

Tips and tutorials around all things tech.

Thinkwareglobal's Blog

Just another WordPress.com weblog

Kenazari's Blog

Just another WordPress.com weblog

Richfowler1's Blog

Just another WordPress.com weblog

Romaicus's Blog

Just another WordPress.com weblog

botlaguduri

Just another WordPress.com site

chandanag89

Just another WordPress.com site

meghshetty

Just another WordPress.com site

digitalmediaexpert

digital media expert blog

Thinking in Silverlight

Silverlight/WPF/Windows 8 Store App

Different Journeys

Let's make life easier!

LAW RESOURCE INDIA

LEGAL RESOURCE CENTRE / COURT JUDGMENTS / LEGAL ARCHIVES

BookConnect

Promoting Indian language Books

Actively Lazy

Software, crafted with passion

SAPonPower

An ongoing discussion about SAP infrastructure

SAP Career

Your Career Mentor

hrsapcertification

Just another WordPress.com site

The secret product manager

Thoughts about product management, SUSE, Linux, ARM processors, Cloud, AIX, Power Systems, and other things that interest me

Sap Certification Material . Com

Quality store for sap software and courses

Simon Les Flex's Blog

SAP Process Integration Specialist - NOW WE CAN DO BETTER!

Oracle Technologies Primer

An Oracle Fusion Middleware and iPaaS blog!

Gilberto Holms

Java, Middleware, SOA Architecture Blog

The Skeleton

Java code skeletons, tips and pointers

J@n van Zoggel

integration, innovation & random technology stuff

The Pragmatic Integrator

Hints and tips from a pragmatic integration specialist

briskwalk

The pace of life..

Optimalbg's Blog

Just another WordPress.com site

IT Jobs in USA

Keep the track of this Blog if you are looking out for some good Opportunities to work in USA....

Referral Jobs | Right Place to Get a Job

Hurry you are one Click away to get a job - Fresher Jobs for 2012, 2013 fresher’s and also high paid jobs for well Experienced IT professionals on Referal jobs.

eccinternational.wordpress.com/

ISO Consulting | ISO 27001 | ISO 20000 | CMMI | BCM | GRI Sustainability Reporting & Assurance | eLearning | Trainings | Philippines

Michael Korn's Blog

Musings on Life, Career, Faith and Technology

WORKINGWITHQTP

Just another WordPress.com weblog

Topics

.Net Core, AspNetCore, Entity Framework, Entity Framework Core, AspNetIdentity, AspNetIdentityCore, Unit Test, WCF, Workflows

SQA and Testers Blog

Just another WordPress.com weblog

Expertqtp's Weblog

Just another WordPress.com weblog

Sai Chamarthi

Experienced Testing Professional

saxenavinay

A great WordPress.com site

Suresh4qtp's Blog

Just another WordPress.com site

jonah95hill

This WordPress.com site is the cat’s pajamas

It's always something...

Just another WordPress.com weblog

Faculty of Information Technology - Lê Ngọc Tiến

Be Yourself! Simplify Our Goals! Nothing is Impossible!

Anti-Malware Testing

Thoughts on security product testing past and present

Methods & Tools

Practical knowledge for the software developer, tester and project manager