Selenium Tutorial

Selenium Tutorial

This tutorial gives you an overview and talks about the fundamentals of Selenium.

Selenium Introduction

What is Automation Testing?

Test automation has grown in popularity over the years because teams do not have the time or money to invest in large test teams to make sure that applications work as they are expected to. Developers also want to make sure that the code they have created works as they expect it to.

Developers use a multitude of different testing frameworks to test different aspects of the system. Selenium is one of the most well‐known testing frameworks in the world that is in use. It is an open source project that allows testers and developers alike to develop functional tests to drive the browser. It can be used to record workflows so that developers can prevent future regressions of code. Selenium can work on any browser that supports JavaScript since Selenium has been built using JavaScript.

Software applications today are written as web‐based applications to be run in an Internet browser. The effectiveness of testing these applications varies widely among companies and organizations. In an era of highly interactive and responsive software processes where many organizations are using some form of Agile methodology, test automation is frequently becoming a requirement for software projects. Test automation is often the answer. Test automation means using a software tool to run repeatable tests against the application to be tested. For regression testing this provides that responsiveness.

What is the use of Automation Testing?

There are many advantages to test automation.

Most are related to the repeatability of the tests and the speed at which the tests can be executed.

There are a number of commercial and open source tools available for assisting with the development of test automation.

Selenium is possibly the most widely‐used open source solution.

Frequent regression testing

Rapid feedback to developers

Virtually unlimited iterations of test case execution

Support for Agile and extreme development methodologies

Disciplined documentation of test cases

Customized defect reporting

Finding defects missed by manual testing

What we need to Automate?

It is not always advantageous to automate test cases. There are times when manual testing may be more appropriate. For instance, if the application’s user interface will change considerably in the near future, then any automation might need to be rewritten anyway.


When Automation is not Recommended ?

Sometimes there simply is not enough time to build test automation.

For the short term, manual testing may be more effective.

If an application has a very tight deadline, there is currently no test automation available, and it’s imperative that the testing get done within that time frame, then manual testing is the best solution.



The Selenium IDE (Integrated Development Environment) is an open source record-and-playback tool for generating Selenium scripts, which is integrated with the Firefox web browser as an extension. It is a renovmed web-based UI test automation tool that extracts any kind of locator from the web page. The locators can be either attribute-based or structure-based, and include ID, name, link, XPath, CBS, and DOM. The IDE has the entire Selenium Core, which allows the users to record, playback, edit, and debug tests manually in a browser. The user actions in the web page can be recorded and exported in any of the most popular languages, such as Java, C++, Ruby, and Python.

Selenium Builder is an alternative open source tool for the Selenium IDE to record and playback web applications. It is an extension of the Firefox web browser, which is similar to the Selenium IDE, but, it has some unique features that the Selenium IDE doesn’t support. Selenium Builder is a standard tool from Sauce labs that runs tests on Sauce Cloud from the Selenium Bader interface itself.

Selenium IDE’s record and playback abilities

Selenium IDE functions

Selenium IDE Data Driven tests

Selenium IDE JavaScript functions

Selenium Builder record and playback

Selenium Builder Data Driven tests

Selenium Builder on cloud

Selenium is a suite of tools to automate web app testing across many platforms. Selenium…runs in many browsers and operating systems. Can be controlled by many programming languages and testing frameworks.

Create by developers at ThoughtWorks

Released publically as an Open Source project on OpenQA

Selenium is a test tool for web applications.

Selenium tests run directly in a browser.

Runs on Windows, Linux, and Macintosh.

Runs in Internet Explorer, Mozilla and Firefox.

Enables Browser Compatibility Testing.

Enables System Functional Testing.


How Selenium works:

Uses JavaScript and Iframes in the browser

Core runs the tests and interrogates the DOM

RC server and Core communicate via AJAX

Language hooks communicate with the RC server.


Advantages of  SELENIUM

           Open source, Free software

           Easy Installation

           Easy Record and Play back

           Supports Multiple operating systems

           Supports Multiple Browser Testing

           Can convert scripts in to other languages (Java, C#, Python, Pearl etc…)

           Easy to learn

           Script once, Run on multiple browsers

          Testing tool for browser‐based testing of web applications. It can be used both for functional, compatibility (it has extensive cross‐browser support) and regression testing.



The selenium IDE plays back recordings as JavaScript inside the browser. JavaScript inside the browser is subject to the follow restrictions:

          JavaScript cannot read from or write to files on the client machine,

JavaScript cannot close a window if it did not open it,

JavaScript cannot access web pages hosted on another domain,

Selenium IDE is only available on the Firefox browser.

Selenium is the best open source tool for doing automation for web based application and it does not have any cost attached to it. The only cost is the effort which will go for designing and developing the script for the application.There are Huge Openings in selenium because companies are trying to migrate from QTP or commercial tools to Selenium – Open source tool.

There are a set of Selenium tools which when combined provides you the power to automate simple to complex web application


What is the difference between Selenium and QTP

  Selenium QTP
1 Open source Commercial
2 Works on all OS Works on Windows only
3 Tests only Web applications Tests web and desktopapplications
4 Code can be converted to any one of languages such asJava, C#, Ruby, Python, pearl, php etc Uses VB script
5 No object repository Has got an object repository
6 IDE sometimes does not record some fields Recording is a little reliableevents

 What is automation testing?

Test automation is the process of simulating a set of (Manual) actions on the given system using an automation tool or utility Note: Automation is not a replacement for manual testing Automation is not intended to find bugs 100% testing can‘t be automated

Why to automate?

Repetitive tests performed by a tester manually

May results in human errors
consume more time

Automation helps to

Reduce repetitive manual interaction with system during testing phase
Improve product reliability & quality by eliminating human errors
Improve test coverage with automation and
Reduce costs of testing (when wisely used)

What to automate?

Tests that need to run for every build

Testes that use multiple data values for same action

Identical tests that need to be executed using different browsers

What not to automate?

Test cases that will only be executed once.

Test cases used for Ad-hoc/random testing

Test cases that are infrequently selected for execution

Test cases that will require manual intervention i.e a task not possible to automate.

The most important one-based on the intuition and knowledge of application

Ex: If you find that you cannot escape from manual intervention

When to automate?

When the testing is a long-term project and the AUT does not change very frequently, test automation is a good idea. And the cost of automation is affordable. Benefits of test automation Fast: Tools runs tests significantly faster than human users

Selenium Tutorial

0 Responses on Selenium Tutorial"

Leave a Message

Your email address will not be published. Required fields are marked *

Copy Rights Reserved © Mindmajix.com All rights reserved. Disclaimer.