What is Java ?
- 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
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.
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
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
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 –
- Install Java JDK as explained in the Post#30 Install Java JDK
- Configure Java as explained in the Post#31 Configure Java
- Understand the Simple Java Program explained in the Post#32 A Simple Java Program
- Install TextPad editor tool as explained in the Post#33 TextPad editor Installation
![]() |
3. Select ‘Compile Java’ option from the Tools Menu -> External Tools Sub Menu (or you can also try Ctrl+1 shortcut key instead):
5. Repeat Step 3 to compile the saved Java file
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 5 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.
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.
Selenium IDE “verifyElementNotPresent” and “waitForElementNotPresent” Commands With Examples
“waitForElementNotPresent” commands with examples. First of all let me describe you both of them and then will look at practical example.
“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.
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′] |