Here in this post I would like to start with the automation of Generic login and log out scenario.

In my previous post, we had discussed about the topics that are needed to learn Selenium WebDriver and the setups required before starting an Automation Test Script. Now here we will learn to write an automation code for Facebook application, in particular, login and logout scenario.

First, let’s write the scenarios that are used to execute login and logout functionality. Following is the order of scenarios required to be automated:

Open a Firefox browser.

Navigate to URL.

Maximise the window.

Enter the Username and Password on Login Page.

Click on Login button.

Sign out from the Facebook account.

Close the window.

Now we will automate the above-mentioned scenarios in the same order in which they are written. First, we need to make sure if we know to create a Java Project, Package, Class, how to import JAR files into the project and how to identify locators for different WebElements as I had mentioned in my previous post. We should also know to use the Eclipse very well.

Before writing the script, we should identify the WebElements and their locators necessary in writing the script. So, following are the WebElements and their locators:

In today’s world where internet is easily available, it is easy to access learning materials. If someone wants to know something new, he/she can get answer from google or tutorial videos available on YouTube. Today people are learning coding, new techniques or anything from any field from the internet.

But, the challenge here lies in finding the right content in right way. If someone wants to learn Java, then the person should know the procedure to learn it and relevant topics to be covered. The purpose of this blog is to identify the topics and the order in which people can understand and learn Selenium WebDriver in easier way.

Here we will just talk about the steps and not the details about a topic. For details on a particular topic, one can find references easily available on the internet.

Before that, let me brief out on Software testing and its types.

Software Testing: It is a process of executing the application with an intention to find defects in it. A defect deviation in application function from the requirement.

So basically, Software testing is the part of quality assurance process which a software has to go through in order to get certified. This is required to ensure the compliance of a software product in relation with regulatory, business, technical, functional and user requirements.

Types of Software Test Execution:

Manual Execution (Also known as Manual Testing)

Automated Execution (Also known as Automation Testing)

Manual Testing: It is a type of testing in which testing is done manually. In this testing, testers do not use any automated tool or any script. There are different stages for manual testing such as unit testing, integration testing, system testing, and user acceptance testing.

Automation Testing: Testing is carried using an automation tool to execute testing scenarios. It is when the tester writes scripts and uses another software to test the product. This process involves automation of a manual process. Automation Testing is used to re-run the test scenarios that are performed manually. It is faster than manual execution and helps in repetitive execution of tests. It is also known as Test Automation.

Apart from Regression testing, Automation testing can also be used as part of Non-functional testing i.e. load testing, performance testing, stress testing etc. It increases the test coverage, improves accuracy, and saves time and money in comparison with manual testing.

Types of Software Testing Tools:

Following are the most popular test tools:-

HP Quick Test Professional

Selenium

IBM Rational Functional Tester

SilkTest

Windmill

Sahi

Here, let me focus on the topics to be covered to learn Selenium Web Driver Basics:

Selenium:

Selenium is a suite of tools to automate web browsers across many platforms. The entire suite of tools results in a rich set of testing functions specifically geared to the needs of testing of web applications of all types. These operations are highly flexible, allowing many options for locating UI elements and comparing expected test results against actual application behaviour.

It has four components and they are as follows:

Selenium Integrated Development Environment (IDE)

Selenium Remote Control (RC)

WebDriver

Selenium Grid

Selenium WebDriver:

Selenium WebDriver is a collection of Core Java APIs. It is not a UI based tool. Technically, it is an interface and all browser classes implements WebDriver interface. It acts as native support with all the browser so that it can directly communicate to browser.

Before learning WebDriver, first and foremost, it is very important to know any of the programming language mentioned above. If we want to use WebDriver with Java, then it is important to have good knowledge of Core Java.

Under Core Java, understanding basics like Methods, Variables, Loops and OOPs concept should be covered in detail. One should also have sound knowledge in String, Exception Handling, Collection and Array. These are the topics which should be properly covered in Java before we start learning WebDriver.

Once we learn Java, next step is to learn HTML basics as it is used for describing web pages and is helpful in identifying locators correctly.

Selenium uses ‘Locators’ to find and match the elements of the webpage that it needs to interact with. Using the right locator ensures tests are faster, more reliable or has lower maintenance over releases. But there will be times when choosing a right locator will become a nightmare. It can be a real challenge to verify that we have the right locators to accomplish what we want.

There are total 8 locators present in WebDriver:-

Id

Name

Linktext

Partial Linktext

Tag Name

Class Name

CSS Selectors

Xpath

As it is important to have good knowledge of mentioned locators.

Following set up should be available in the system:

Download and open Eclipse.

Download Selenium WebDriver from Selenium official website and add it as external libraries in Eclipse.

Download Apache POI from Apache POI official website and add it as external libraries in Eclipse.

Download TestNG from Eclipse’s market place and install it.

Below is the advisable order in which topics should be taken up before starting with framework: