Selenium

What is Java ?

 Java is a platform-independent and object oriented programming language.
  • Object Oriented Programming Language: As Structured programming languages like C failed to manage the complex application’s code due to lack of organizing the code capability, as a result object oriented programming (OOP) was invented. OOP is a programming methodology that helps organize complex programs through the use of inheritance, encapsulation and polymorphism methodologies.
  • Platform-Independent Programming Language:  The output of a Java compiler is not executable code rather its a bytecode. Bytecode is a highly optimized set of instructions designed to be executed by Java run-time system, which is called the Java Virtual Machine (JVM). Translating a Java program into bytecode makes it much easier to run a program in a wide variety of environments because only the JVM needs to be implemented/designed for each platform. So the use of byte code as an intermediate language permits Java to run on any platform.

Install Java JDK

Eclipse IDE is required to run Java programs. But we cant run Eclipse IDE without having Java Development kit (JDK) installed in our machines. So if you have not installed Java JDK as explained in previous posts, install Java JDK first as explained in the below steps:

1. Open http://www.oracle.com/technetwork/java/javase/downloads/index.html in any browser
2. Select ‘Java Platform (JDK) category’ to download Java JDK as shown below –

3. Select the ‘License Agreement’ as shown below:

4. Download the 32 bit version of Java JDK (i.e. Windows x86 in the below screen) if you have 32 bit machine else if you have 64 bit machine install 64 bit version of Java JDK  (i.e. Windows x64 in the below screen) –

5. Install the downloaded JDK file and ensure that JDK and JRE folders got created at the C:\Program Files (x86)\Java folder path for 32 bit machine (But for 64 bit machine they will get created at the C:\Program Files\Java folder)

Configure Java

 Pre-requisite You have to install Java JDK as explained in my previous Post#30 Install Java JDK
Configuring the Java JDK:

Follow the below steps to configure the Java JDK:
We have to configure the Java by configuring the build path.

If you want to save the created java files outside the bin folder then you have to set path of JDK. Path is required for using Javac and Java tools. Javac tool compiles the Java code and Java tool will run the code.

 
How to set path of JDK will be explained below:

1. Click on ‘My Computer’ icon on your desktop as shown below –

2. When your drives are displayed in your My Computer window, right click any where inside the window and select ‘Properties’ option as shown below –

3. Click on ‘Advanced System Settings’ option as shown below:

4. Click on ‘Environment Variables Button as shown below:

5. Click on ‘New’ button under the User variables as shown below:

6. Type ‘path’ into the ‘Variable Name’ as shown below:

7.  In 32 bit machines -> Go to C:\Program Files (x86)\Java\jdk[Version]\bin folder and copy the path of the bin folder as shown below (But in 64 bit machines -> You need to go to C:\Program Files\Java\jdk[Version]\bin folder )

8. Paste path of the bin folder in Variable Value field as shown below and click on ‘OK’ button

9. Ensure that the path is added under the User variables and Click on ‘OK’ button as shown below to finish the process

Check whether the Installed and configured Java works:

1. Open Windows Command line as shown below:

2. Type the command java -version in the Command line window as shown below and press ‘Enter’ key on your keyboard as shown below:

3. Ensure that the Java version we’ve installed and configured is displayed on executing the command specified in step 2 as shown below:

If you see the version of Java that is installed as shown in the above screenshot, it means that your Java is working.

Now you are ready to run any java program. But before running the Java program lets go through a sample Java program and understand the basic concepts. 

Notes –

1. You can also install JRE (Java Run Time Environment) instead of JDK (Java Development Kit). You can use Eclipse IDE and develop automation scripts when you install JRE instead of JDK prior to installing Eclipse IDE as Eclipse IDE contains its own features for developing and compiling Java.

2. If you want to Run Java Programs using any other editors instead of Eclipse IDE, then installation of Java JDK is must as the editors wont have  features to develop and compile Java programs. So installing JRE prior to running Java programs on any other editors instead of Eclipse IDE wont work. JDK is must in this case.

3. When you are running your automation scripts developed using Java programming language on Eclipse IDE, you can simply install JRE instead of JDK if you want to save your computers memory. JRE installation take less time and less memory to store.

TextPad editor installation

 TextPad is an editor which will help us in writing Java Programs and execute them from the editor itself, i.e. instead of executing the java program from command line. Below, I will explain from where we’ve to download the TextPad and how to install it.

1. Go to  http://www.textpad.com/download/ page
2. Choose the English User interface and click on ‘Download’ link as shown below (Install 32-bit if you have 32 bit machine or Install 64-bit if you have 64 bit machine):

3. Right click on the downloaded Zip file and unzip it (I use WinRAR software to unzip Zip files) as shown below:

4. Open the unzipped folder and double click on the Setup file to install the software as shown below:

5. Ensure that you are able to launch the TextPad application without any problems after its installation as shown below:

assertTitle
assertValue
assertVisible
assertWhetherThisFrameMatchFrameExpression
assertWhetherThisWindowMatchWindowExpression
assertXpathCount
assignId
assignIdAndWait
break
captureEntirePageScreenshot
captureEntirePageScreenshotAndWait
check
checkAndWait
chooseCancelOnNextConfirmation
chooseOkOnNextConfirmation
chooseOkOnNextConfirmationAndWait
click
clickAndWait
clickAt
clickAtAndWait
close
contextMenu
contextMenuAndWait
contextMenuAt
contextMenuAtAndWait
controlKeyDown
controlKeyDownAndWait
controlKeyUp
controlKeyUpAndWait
createCookie
createCookieAndWait
deleteAllVisibleCookies
deleteAllVisibleCookiesAndWait
deleteCookie
deleteCookieAndWait
deselectPopUp
deselectPopUpAndWait
doubleClick
doubleClickAndWait
doubleClickAt
doubleClickAtAndWait
dragAndDrop
dragAndDropAndWait
dragAndDropToObject
dragAndDropToObjectAndWait
dragdrop
dragdropAndWait
echo
fireEvent
fireEventAndWait
focus
focusAndWait
goBack
goBackAndWait
highlight
highlightAndWait
ignoreAttributesWithoutValue
ignoreAttributesWithoutValueAndWait
keyDown
keyDownAndWait
keyPress
keyPressAndWait
keyUp
keyUpAndWait
metaKeyDown
metaKeyDownAndWait
metaKeyUp
metaKeyUpAndWait
mouseDown
mouseDownAndWait
mouseDownAt
mouseDownAtAndWait
mouseDownRight
mouseDownRightAndWait
mouseDownRightAt
mouseDownRightAtAndWait
mouseMove
mouseMoveAndWait
mouseMoveAt
mouseMoveAtAndWait
mouseOut
mouseOutAndWait
mouseOver
mouseOverAndWait
mouseUp
mouseUpAndWait
mouseUpAt
mouseUpAtAndWait

Selenium IDE – Free Web Software Testing – Regression Testing tool



Selenium IDE
is software testing tool for web applications. It provides record and playback facility to regression test any web application. To use selenium IDE software testing tool, It is not compulsory to have any software programming language knowledge.


Selenium IDE is open source web application testing tool. Selenium IDE software testing tool provides facility to export recorded script in many languages like HTML, Java, Ruby, RSpec, Python, C#, JUnit and TestNG. You can use these exported script in Selenium RC or webdriver. Script which you create for software web application testing is called test case in selenium IDE language and set of test cases is called test suite in selenium IDE software testing tool. We will learn more about it in latter posts.

To use selenium IDE for regression testing of web application, you have to download it from link given here. Click here to Free download Selenium IDE. You can find latest released version for downloading.But one thing i would like to clarify here is that selenium IDE supports only Mozilla Firefox web browser. So don’t try to download it in any other web browser. See my next post to learn how to download and install Selenium IDE in step by step process.

selenium ide download, selenium ide tutorial, selenium ide plugin, how to use selenium ide, selenium testing, selenium tutorial, selenium testing tool, selenium tool, what is selenium testing, automated testing tools


how to download and install selenium IDE step by step process

Selenium IDE download and install step by step process

    • Open Mozilla Firefox Browser.
    • Type URL : http://seleniumhq.org/download/ in your browser. Selenium IDE download page will get open then click on latest Download version link (Here is 1.3.0) as shown in image bellow. click on that link.
  •  
  •  When you click on latest Selenium IDE Download version link, Firefox will show one popup saying do you want to allow Mozilla Firefox to installselenium IDE software application or not. Click on Allow button as shown in image bellow.
  • When you click on allow button, Firefox will automatically install Selenium IDE software. after completion of Selenium IDE installation, it will show one pop up saying Selenium IDE installation completed. you need to restart your browser to use selenium IDE software application. Click on Restart Now button as show in image bellow.
  •  
  • When you click on Restart Now button, Firefox will restart automatically. now click on Tools menu list displayed in top. you can see there Selenium IDE as shown in image bellow.
  •   
  • Click on Selenium IDE as shown in image above. It will launch Selenium IDE software window as shown in image bellow.

So these are the steps to download and install Selenium IDE software application. Now you can use it to record and play your web application test. Comment here if you face any problem in download and install selenium IDE. I will guide you personally. See my next post to know how to use selenium IDE

YOU CAN SUBSCRIBE VIA EMAIL TO GET ALL SELENIUM IDE COMMAND EXAMPLES VIA EMAIL

Click Here to view Complete List Of Selenium IDE Commands with Example
download selenium ide, selenium ide download, install selenium ide, selenium, download selenium, selenium testing, selenium ide tutorial, selenium download, selenium documentation, selenium test, free downloads software, open source downloads, selenium tool, download selenium ide for windows, selenium ide extensions, selenium ide plugin, selenium tests, selenium scripts, download ide, using selenium ide, testing selenium, selenium open source, selenium ide help, selenium script, selenium recorder, free download web browser, selenium ide addon, web browser free download, browser free download, selenium plugins, selenium help, selenium ide extension, selenium 2 tutorial, download selenium testing tool, gwt selenium, selenium ide install, selenium linux, 02 downloads, selenium testing software

Write and execute Java Programs using TextPad tool

Object Oriented Programming

 What is Object Oriented Programming ?

Object Oriented Programming organizes a program around its data (that is objects) and a set of well defined interfaces to that data. Object Oriented Program can be characterized as data controlling access to code.

Object Oriented Programming methodology is to design a program using classes and objects.It simplifies the software development and maintenance by providing some concepts:

  •  Object
  •  Class
  •  Inheritance
  •  Polymorphism
  •  Abstraction
  •  Encapsulation

Object 

Object is an instance of a class. i.e. In Java program we’re going to use object as an instance of a class as shown below:

class Pen   // Pen is a class. It is a template for creating objects.
{
public static void main(String args[])
{
Pen Reynolds = new Pen();  // Reynolds and Parker are objects. These objects are just instances of the class Pen.
Pen Parker = new Pen();
}
}

Class

Any concept you wish to implement in Java must be encapsulated in a Class. And also the class is a template or blueprint from which objects are created.

class Pen   // Pen is a class. It is a template for creating objects.
{
public static void main(String args[])
{
Pen Reynolds = new Pen();  // Reynolds and Parker are objects. These objects are just instances of the class Pen.
Pen Parker = new Pen();
}
}

Abstraction

Abstraction in java is used to hide certain details and only show the essential features of the object.

For example: – People don’t think of a car as set of tens of thousands of individual parts, instead think car as a well defined object with its own unique behaviors like Speed, Mileage etc.

Encapsulation

Encapsulation is a protective wrapper that prevents the code and data from being arbitrarily accessed by the other code defined outside the wrapper. Access to code and data inside the wrapper is tightly controlled through a well defined interface.

Class is the protective wrapper that prevents the code and data from being arbitrarily accessed by the other code defined outside the wrapper . The Code and  Data are called as the members of a class. The data defined by the class are referred to as instance variables. The code that operates on the defined data is called as method. Methods define how the instance variables/data can be used (i.e. Behavior and interface of a class are defined by methods that operate on  its instance variables/data). Since the purpose of the class is to encapsulate complexity, there are mechanisms for hiding the complexity of the implementation  inside the class. Each method or variable in a class can be marked as public or private. The public method or variable inside a class can be accessed from the outside of the class, where as the private method or variable inside a class cant be accessed outside of the class.

i.e. In Java, code (i.e. Methods) and data (i.e. instance variables) are protected inside a wrapper called  class.

Inheritance

Inheritance is a mechanism in which one object acquires the properties of another object. The following example will show you how the objects are hierarchically organized and how the child objects inherit the properties from the parent objects

In programming like Java, the idea behind using Inheritance concept is to create a new classes built upon existing classes. i.e. The new classes reuses the methods and data by inheriting them from the existing classes.

Polymorphism

Polymorphism means of having many forms. In programming languages like Java, polymorphism concept is subjected to methods, where the code inside the same method can perform differently on different conditions.

Example: – Suppose there a method called ‘Smell’ under class ‘Dog’. The output of the ‘Smell’ method can take several forms i.e. 1. When a dog smells a cat -> The output of the ‘Smell’ method will be ‘The dog barks and runs after the cat’ 2. When a dog smells food -> The output of the ‘Smell’ method will be ‘The dog will salivate and run after its bowl’. Hence in this example I want to conclude that the same  method ‘Smell’ will take different forms based on what the dog smells.

Pre-requisites –

  1. Install Java JDK as explained in the Post#30 Install Java JDK
  2. Configure Java as explained in the Post#31 Configure Java
  3. Understand the Simple Java Program explained in the Post#32 A Simple Java Program
  4. Install TextPad editor tool as explained in the Post#33 TextPad editor Installation
Please follow the below steps to write and execute Java programs using TextPad editor tool:
1. Launch TextPad editor tool as shown below:
2. Write any sample Java program in the editor tool as shown below:

3. Select ‘Compile Java’ option  from the Tools Menu -> External Tools Sub Menu (or you can also try Ctrl+1 shortcut key instead):

4. Ensure that the ‘Sava As’ dialog is displayed. In ‘Save As’ dialog, ensure that ‘Save As Type’ is selected as All Files , type ‘Simple.java’ into the ‘File Name’ field (Ensure that the class name you have mentioned in the above java program and the name you are giving here to save the Java file should match else the java program will throw an error i.e. class Simple in the java code and Simple.java while saving) and click on ‘Save’ button as shown below:

5. Repeat Step 3 to compile the saved Java file

6. Select ‘Run Java Application’ option from the Tools Menu -> External Tools Sub Menu (or you can also try Ctrl+2 shortcut key instead)

7. Observe that the output of the above written Java program is displayed in the command window as shown below:

 

Second Simple Java Program

 First lets understand the concept of Variables followed by writing the second simple Java program.

Variables

Variable is a named memory locations that can be assigned a value by your program.

Example of a variable in Java Programming Language:

int num = 5;

Here num is a variable name to which the value is assigned. And also this variable name is declared as int to store integer values like 5.

Second Simple Java Program

/*
Here is another short example.
Call this file ‘Example2.java’.
*/

class Example2
{

public static void main(String args[])
{

int num;   // This statement declares the variable called num as integer variable.

num = 100; // This statement assigns the value 100 to the integer variable num.

System.out.println(“This is num: ” + num);  //This prints the current holding value of num variable 

num = num * 2;  // This statement multiplies the value assigned to the num integer variable by 2. i.e. num = 100 * 2. So after multiplications the resultant value will be stored in num (i.e. num will be holding 200 after Java executing this statement)

System.out.print(“The value of num * 2 is “);
System.out.println(num);  

}

}

Output of this program

This is num: 100
The value of num*2 is 200

Observe that though we have three print statements, we got the output for only two. This is because the second print statement is using print( ) method instead of println( ) method to print the output. Hence at the output console the third print statement will get printed in the same line of the second print statements output. In order to have the all the statements in this program to print the outputs in the separate lines we have to use println( ) method instead of print( ) statement in the second print statement.


How to use selenium ide toolbar elements

If you are new for using selenium IDE software testing tool then first of all you have to understand how to operate Selenium IDE.

Here i have described how to use selenium IDE software testing tool’s different elements and its functions.

Speed Controller :

In Selenium IDE, Speed controller is used to control the speed of how fast your test case runs. Set it on fast if you want to run fast test case and set it to slow if you want to run your test case slow.

Note : You can view full selenium IDE tutorial with advanced functions at this link.

Run All Button :

In Selenium IDE, Run All button is used to run the entire test suite. Suppose you have created 5 test cases for you software web application and stored all them in one test suite and if you like to run all they 5 then open your test suite and press this button. it will run all the 5 test cases one by one. 
Run Button : 
 In Selenium IDE software testing tool, Run All button is used to run the selected any one test case.

Pause/Resume Button :

In Selenium IDE software, pause button is used to pause the running test case and resume button is used to resume or restart paused test case.

 
Step Button :
 In Selenium IDE software testing tool, Step button is used to run test commands manually one by one. Suppose you have paused your test case and now you like to run remaining commands one by one then you can use step button. Basically step button is used debug the script in selenium IDE software.
Click to Record/ Stop Recording Button :

In Selenium IDE, Record button is used to record the users browser navigation of web application software and creating test script for reusing it and stop record button is used to stop recording.

Command Table :

Command table shows the recorded commands. you can also modify commands or insert any command in between. there are three elements in each command.

  1. Command : Command column describes name of command.
  2.  Target : Target column describes Target element id or name or Xpath
  3. Value : Value column describes Value of an element

See my next post to know how to record sample script in Selenium IDE.


Record and play sample script in selenium ide

Now all you are familiar about selenium IDE software testing tool bar and its different components. Now lets we record and play sample script in selenium IDE software testing tool. Follow bellow given steps to record script in selenium IDE software testing tool.

Recording sample script in Selenium IDE

  • Open new tab in Mozilla Firefox browser.
  • Open selenium IDE software testing tool.
  • Click on “Record” button. (Please note here. It will start recording all navigation and action once you click on “Record” button.
  • Now enter URL “https://www.google.co.in/” in your browser. (Selenium IDE will record that action. Make sure your recording is working fine.)
  • Click on “Images” link displayed in main menu.
  • Click on “Maps” link displayed in main menu.
  • Click on “Play” link displayed in main menu.
  • Stop Selenium IDE recording by clicking on “Stop Record” button. Your recording is completed now.
  • My script will looks like bellow in selenium IDE.
New Test
Command Target Value
open https://www.google.co.in/
clickAndWait css=#gb_2 > span.gbts
assertTitle Google Images
clickAndWait css=#gb_8 > span.gbts
assertTitle Google Maps
clickAndWait css=#gb_78 > span.gbts
assertTitle Google Play

Now Save your script into your computer for future use.

Note : Selenium IDE software testing tool is designed to support only web application testing. You can not test desktop or mobile applications using selenium IDE. If you want to test mobile application then you need to use webdriver.

Play sample script in Selenium IDE
It is easy to play script in selenium IDE if it is recorded perfectly. You can play your script by simply clicking on “Play current test case” button in selenium IDE. Once you click on that button, It will perform all those actions which you have recorded on your browser.


How To Generate Mouse Scrolling Event Using Selenium IDE With Example Tutorial

Many tutorial post are available for selenium IDE Mouse related commands but mouse scrolling event was missing from them till now. You need mouse scrolling event when you are testing software application like Facebook. In Facebook, post are loaded on mouse scrolling if you have seen. In this kind of scenario,

you need to generate mouse scrolling event in selenium IDE.

Let me give you an example. First of all open one page which contains vertical scroll bar(long description page) and then run bellow test case in selenium IDE.

 

New Test
Command Target Value
store 40 i
store 0 looptimes
while storedVars.looptimes <= 20
storeEval selenium.browserbot.
getCurrentWindow().scrollTo(0,${i})
store javascript{storedVars.looptimes++;}
storeEval ${i}+40 i
endWhile

 

(Note : You need to attache user-extension.js file with selenium IDE to get support of “while” command in selenium IDE. Click here to view steps of downloading and installing user-extension.js file with selenium IDE.)
When you run above script in selenium IDE, it will scroll your page vertically if scroll bar is there on page.
  • You can change while loop value from ’20’ to your choice depending on length of page. If page is lengthy then increase that value.
  • ‘selenium.browserbot.getCurrentWindow().scrollTo(0,${i})’ is used with “storeEval” command for generating scroll event on page using selenium IDE. If you want to generate scroll event on horizontal scroll bar then use ”selenium.browserbot.getCurrentWindow().scrollTo(${i},0)”. It will create horizontal scrolling event on software web application page.
  • In above script you can change ${i}+40 –> ${i}+60 to increase or ${i}+40 –> ${i}+20 to decrease scrolling speed.

Selenium IDE Tutorial : “verifySelectedId” and “verifyNotSelectedId” commands with example

Earlier we had seen how to verify selected value of drop down or list box using LABEL, VALUE and INDEX. In selenium IDE, there is one more command is “verifySelectedId” to verify id of selected value in drop down or list box. If your drop down value contains id attribute then you can use it to select it. Let me

explain you two related commands with example.

“verifySelectedId” Command
“verifySelectedId” command will check the id attribute of current selected value and compare it with expected id. If both match then it will pass else it will fail and return error like “[error] Actual value ‘car1’ did not match ‘car2′” in log.
“verifyNotSelectedId” Command
“verifyNotSelectedId” command will retrieve and compare id attribute of selected value. If expected and actual match then it will fail else it will pass. Both these commands works only if drop down values contain id attribute.
New Test
Command Target Value
open http://only-testing-blog.blogspot.in/2014/01/textbox.html
verifySelectedId //select[@id=’Carlist’] car1
verifySelectedId //select[@id=’Carlist’] car2
verifyNotSelectedId //select[@id=’Carlist’] car1
verifyNotSelectedId //select[@id=’Carlist’] car2

 

Run above example and verify result. For both commands, one will pass and one will fail. Prepare same test case of your software web application’s regression test scenario and verify result.

Selenium IDE “verifyElementNotPresent” and “waitForElementNotPresent” Commands With Examples

In any software application regression test case, you need to verify and wait for different conditions as per test scenario requirement. Selenium IDE has many different buit in VERIFICATION and WAITFOR commands to handle that particular situation. Today we will look at “verifyElementNotPresent” and

“waitForElementNotPresent” commands with examples. First of all let me describe you both of them and then will look at practical example.

“verifyElementNotPresent” Command

“verifyElementNotPresent” command will verify that targeted element is present on page or not. It will pass if targeted element is not present on page else it will return [error] true in execution log. You can view example of “verifyElementPresent” command which works opposite to “verifyElementNotPresent” command.

VIEW WEBDRIVER EXAMPLE OF “verifyElementNotPresent”

“waitForElementNotPresent” Command
Selenium IDE will wait till targeted element of “waitForElementNotPresent” command disappears from the page. Once targeted element disappears from the page, selenium IDE will execute next command. Maximum wait time will be default timeout time of selenium IDE.

Example of “verifyElementNotPresent” and “waitForElementNotPresent” Commands

New Test
Command Target Value
open http://only-testing-blog.blogspot.in/2014/01/textbox.html
verifyElementNotPresent //input[@id=’text3′]
waitForElementNotPresent //input[@id=’text4′]
verifyElementNotPresent //input[@id=’text3′]
In above example, 1st “verifyElementNotPresent” command will pass because on that stage, targeted element //input[@id=’text3′] is not present on page. 2nd “waitForElementNotPresent” command will wait for targeted element to appear on page. last “verifyElementNotPresent” command will return error because on that stage targeted element is available on page.

Selenium IDE “verifyConfirmation” and “assertConfirmation” Command Examples

Before reading this post about “verifyConfirmation” and “assertConfirmation” Command example, you must have to look at other verification Commandand Assertion Command examples. “verifyConfirmation” and “assertConfirmation” both are working with confirmation message generated during previous action by selenium IDE. Click here to read – difference between “assert” and “verify” in selenium with examples. Let me describe “verifyConfirmation” and “assertConfirmation” commands with examples.
“verifyConfirmation” Command
“verifyConfirmation” command will retrive the confirmation message text and compare it with targeted text. Return error message like ‘[error] Actual value ‘Press ‘OK’ or ‘Cancel’ button!’ did not match ‘Press ‘Cancel’ button!” of both text not match. Else it will be pass.
“assertConfirmation” Commands
“assertConfirmation” command’s function is same as “verifyConfirmation” command. Only difference is it will stop execution on failure of “assertConfirmation” command.
Here is one simple example on both the commands. Run it in selenium IDE and try to implement it in your software application regression test case.

 

New Test
Command Target Value
open http://only-testing-blog.blogspot.in/2013/10/table.html
click css=button
verifyConfirmation Press ‘OK’ or ‘Cancel’ button!
click css=button
verifyConfirmation Press ‘Cancel’ button!
click css=button
assertConfirmation Press ‘OK’ or ‘Cancel’ button!

 


Selenium IDE “verifyNotSelectedIndex” and “verifyNotSelectedIndexes” Command Example

verify” and “assert” are same in function but difference between both of them is when “verify” command fails selenium will not stop execution of remaining commands while selenium IDE will stop execution on failure of “assert” command. “verifyNotSelectedIndex” and “verifyNotSelectedIndexes” are verification

commands so selenium IDE will not stop its execution even if anyone from them will fail. It will just return error in log and go for executing next command.

“verifyNotSelectedIndex” Command
This command will works with only single selected value of drop down and list box . It will check if selected value’s index is same as expected? If yes then it will return error message in log like ‘[error] Actual value ‘5’ did match ‘5”. If don’t match then it will pass. If found multiple selections in list box then it will return ‘[error] More than one selected option!’.
“verifyNotSelectedIndexes” Command
“verifyNotSelectedIndexes” Command’s function is same but it is working for single selected as wel for multiple selections from list box.
New Test
Command Target Value
open http://only-testing-blog.blogspot.in/2013/09/testing.html
addSelection name=FromLB label=Germany
verifyNotSelectedIndex name=FromLB 5
verifyNotSelectedIndex name=FromLB 6
addSelection name=FromLB label=India
verifyNotSelectedIndexes name=FromLB 4,5
verifyNotSelectedIndexes name=FromLB 6,7
Look in to above example, 1st “verifyNotSelectedIndex” command will fail and return error “[error] Actual value ‘5’ did match ‘5’” because both values matches. 2nd “verifyNotSelectedIndex” command will pass. 1st “verifyNotSelectedIndexes” will fail and 2nd “verifyNotSelectedIndexes” command will pass. Let me knows the reason why?
Experiment above given example in your own software application to get better idea on both of these commands. Click here to read and learn more selenium IDE tutorials with examples of commands.

Selenium IDE “verifyOrdered” and “assertOrdered” Commands Example

“verifyOrdered” and “assertOrdered” commands in selenium IDE are provided to verify the element’s sort order of same parent node on software web application page. It will check sort order of element in ascending order. Look in to bellow given image.

Here 1st input node’s sort order is 1 and 2nd input node’s sort order = 2 and both of them are under same parent node.
“verifyOrdered” Command
“verifyOrdered” command will pass if specified both elements are in ascending order. Else it will return ‘[error] false’ in log. But here selenium will not stop execution even if “verifyOrdered” command fails.
“assertOrdered” Command
Same way, “assertOrdered” command will be pass if both elements ordered else will return ‘[error] false’ and selenium will stop execution.
Let we take example for above screenshot. Run bellow given test case in selenium IDE.
New Test
Command Target Value
open http://only-testing-blog.blogspot.in/2013/09/testing.html
verifyOrdered name=lname name=fname
verifyOrdered name=fname name=lname
assertOrdered name=lname name=fname
assertOrdered name=fname name=lname
First “verifyOrdered” will be fail because sort order of ‘name=lname’ and ‘name=fname’ is incorrect. 2nd “verifyOrdered” command will be pass. same way 3rd “assertOrdered” command will fail and selenium will stop execution.For more verification commands you can click here and for more assertion commands you can click here.