Introduction to Selenium

There are many testing tools available in the market like QTP, SilkUI, and Selenium etc. But people prefer Selenium because Selenium is an open source (i.e. you can download this tool for free) automation testing tool. We have QTP also for automation testing but you need to pay to HP guys if you want to use QTP.

It is used exclusively for web-based applications.QTP can work on windows but Selenium can be used exclusively for web-based applications.

You can work on multiple operating systems using Selenium. Selenium is the only tool which can work on MAC, Windows, Linux, and Solaris.

Platforms supported By Selenium:

Windows

OS X (Mac OS)

Linux

Solarsis

Currently, it supports mobile as well. There is another tool called Appeium which is an extension to Selenium. Appeium provides support to IOS as well as Android.

Languages used with Selenium:

You can write Selenium code in any of the below languages

Java

C#

Ruby

Python

PHP

Perl

NOTE: If your application is built on one language, you may use some other language to automate it. Like if your application is developed in C# and to automate its testing you may use Java.

SO THE LANGUAGE WHAT YOU WRITE YOUR AUTOMATION CODE IS INDEPENDENT OF THE LANGUAGE WHAT YOUR APPLICATION IS BUILT ON.

Browsers supported by Selenium:

Internet Explorer

Firefox

Chrome

Safari and many more

Selenium is the only tool which supports cross browsers.

Due to so many features (like multiple language support, multiple browser support, multiple OS support) provided by Selenium, it is so popular in the market.

Selenium History:

Selenium came into existence in 2004 when Jason Huggins was testing an internal application at ThoughtWorks.

Available versions of Selenium:

Selenium 1.0 –formally we call it as RC (Remote control server). It is officially depreciated by Selenium team.

Reason for Depreciation is:

Below is the Architecture of Selenium 1.0:

Selenium 2.0 –Web Driver

Recently Selenium 3.0 version also came (for it, minimum java version required is 1.8)

Architecture of Selenium 2.0 –Web Driver:

So we are overcoming the 1st drawback of Selenium 1.0.

How 2nd drawback is overcome:

Editor instead of using java to trigger the events, uses Browsers own/native language to trigger the events (or to talk to the application). Let’s say our Firefox browser is built in Java so to talk to a website which is running on Firefox, editor use java. Our IE is built upon C# so editor uses C# to talk to the application in C#. The website which is running on IE cannot stop C# to trigger an event so hence the 2nd problem is resolved.

Working of Selenium WebDriver:

Selenium WebDriver working can be explained in 2 ways:

Non-technical – using analogy

Technical

Non-technical – using analogy: To explain working, analogy used is taxi driving.

The way a taxi driver drives a taxi, same way Selenium WebDriver drives a browser.

In taxi driving, there are 3 parts:

The client, who decides where to go and how to get there. He informs this to the taxi driver.

The taxi driver, who acts as per the client’s requests and sends his own requests to the car.

The car, it acts as per the taxi driver’s requests.

Similarly, in Selenium WebDriver test automation (and other tools), there are 3 parts:

Test engineer, who writes the automation code, which sends requests to the browser driver component.

The browser driver component, who executes the test requests, sent by the engineer, it sends its own request to the browser.

The browser, who executes the browser driver requests.

So this is the analogy:

Test engineer <-> The client

The browser <->Taxi driver

The browser <->Taxi(Car)

Technical explanation:

Below steps take place when the automation script is executed:

For every Selenium command, a HTTP request is created and sent to the browser driver

Using HTTP server, the browser driver get the HTTP requests

The HTTP server implements the Selenium command and executes them on the browser

The execution status is sent back to the HTTP server which in turn sends the status back to the automation script.

One who is good in solving logical puzzles: Software will go to the market if a tester says there are no bugs in the software and it is ready to release. Tester finds bugs & also breaks the system in terms of stress testing.

One who love helping others: A tester help in releasing a quality product to the market. To release a good product, developers do their best. But still chances are there will be some mistakes. Being a tester you need to find those mistakes.

One who loves to take challenges: A tester needs to explore the system for understanding and finding bugs. Then he reports the bugs, which are fixed by the developer. Hence finally a quality product is delivered to the market.

One who loves to write code: A Automation Tester writes code to find the bugs in the system and thus a quality product will be delivered.

One who loves to interact with people: A tester needs to interact with developers and client to get more information on domain knowledge.

One who loves to be in a team where quality products will be delivered: Being a tester one help in delivering a quality product which makes everybody happy.