Lesson 1: Introduction to Selenium
Overview of Selenium
Selenium is a set of different software tools each with a
different approach to supporting test automation. Most Selenium QA Engineers
focus on the one or two tools that most meet the needs of their project,
however learning all the tools will give you many different options for
approaching different test automation problems. 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 behavior. One of Selenium’s key features is
the support for executing one’s tests on multiple browser platforms.
Selenium is an open source portable software testing
framework for web applications. Selenium provides a record/playback tool for
authoring tests without learning a test scripting language (Selenium IDE). It
also provides a test domain-specific language (Selenese)[1] to write tests in a
number of popular programming languages, including Java, C#, Groovy, Perl, PHP,
Python and Ruby. The tests can then be run against most modern web browsers.
Selenium can be deployed on Windows, Linux, and Macintosh platforms.
Browser and Operating System Support
Selenium-WebDriver
Selenium-WebDriver supports the following browsers along
with the operating systems these browsers are compatible with.
Browser
|
Operating System
|
Google Chrome
|
Windows
|
Internet Explorer 6,
7, 8, 9, 10 - 32 and 64-bit where applicable
|
Linux
|
Firefox: latest ESR, previous ESR, current
release, one previous release
|
Macintosh
|
Safari
|
|
Opera
|
|
HtmlUnit
|
|
Phantomjs
|
|
Android (with Selendroid or appium)
|
|
iOS (with ios-driver or appium)
|
Selenium Flavors
Selenium is composed of multiple software tools. Each has a
specific role.
Selenium 2 (also known as. Selenium Webdriver)
Selenium 2 is the future direction of the project and the
newest addition to the Selenium toolkit. This brand new automation tool
provides all sorts of awesome features, including a more cohesive and objects
oriented API as well as an answer to the limitations of the old implementation.
It supports the WebDriver API and underlying technology,
along with the Selenium 1 technology underneath the WebDriver API for maximum
flexibility in porting your tests. In addition, Selenium 2 still runs Selenium
1’s Selenium RC interface for backwards compatibility.
Selenium 1 (also known as. Selenium RC or Remote Control)
Selenium 1 is still actively supported (mostly in
maintenance mode) and provides some features that may not be available in
Selenium 2 for a while, including support for several languages (Java,
Javascript, Ruby, PHP, Python, Perl and C#) and support for almost every
browser out there.
Selenium IDE
Selenium IDE (Integrated Development Environment) is a
prototyping tool for building test scripts. It is a Firefox plugin and provides
an easy-to-use interface for developing automated tests. Selenium IDE has a
recording feature, which records user actions as they are performed and then
exports them as a reusable script in one of many programming languages that can
be later executed.
Selenium-Grid
Selenium-Grid allows the Selenium RC solution to scale for
large test suites and for test suites that must be run in multiple
environments. Selenium Grid allows you to run your tests in parallel, that is,
different tests can be run at the same time on different remote machines. This
has two advantages. First, if you have a large test suite, or a slow-running
test suite, you can boost its performance substantially by using Selenium Grid
to divide your test suite to run different tests at the same time using those
different machines. Also, if you must run your test suite on multiple
environments you can have different remote machines supporting and running your
tests in them at the same time. In each case Selenium Grid greatly improves the
time it takes to run your suite by making use of parallel processing.
Selenium Core
Selenium Core (on which RC was based) was essentially a JavaScript application, running inside the browser's security sandbox.
Because Selenium was written in pure JavaScript, its initial
design required developers to host Core and their tests on the same server as
the application under test (AUT) in order to avoid falling foul of the
browser's security policies and the JavaScript sandbox.
Let’s now try to learn the components of Selenium RC and its
architecture.
Selenium RC components are:
Ø
The Selenium Server which launches and kills
browsers, interprets and runs the Selenese commands passed from the test
program, and acts as an HTTP proxy, intercepting and verifying HTTP messages
passed between the browser and the AUT.
Ø
Client libraries which provide the interface
between each programming language and the Selenium RC Server.
Selenium RC architecture
Selenium Server receives Selenium commands from your test
program, interprets them, and reports back to your program the results of
running those tests.
The RC server bundles Selenium Core and automatically
injects it into the browser. This occurs when your test program opens the
browser (using a client library API function). Selenium-Core is a JavaScript
program, actually a set of JavaScript functions which interprets and executes
Selenese commands using the browser’s built-in JavaScript interpreter.
The Server receives the Selenese commands from your test
program using simple HTTP GET/POST requests. This means you can use any
programming language that can send HTTP requests to automate Selenium tests on
the browser.
Lesson 2: Selenium IDE GUI features
Installing Selenium IDE
Selenium IDE can be installed in two different ways. Please
find them as explained below:
Method # 1:
Open Firefox browser and navigate to Tools-->Add-ons
In the Add-ons Manager tab, search for Selenium IDE (refer
to following screenshot)
Click on ‘Install’ button displaying against Selenium IDE
Button 1.2.0
After successful downloading the add-on, a message would be
displayed to restart Firefox
Click on Restart now and
the browser would be restarted to show the Add-on manager
Now, to view the Selenium IDE in the taskbar, navigate to
View-->Toolbars-->Customize
From the ‘Customize Toolbar’ pop-up, find Selenium IDE icon,
drag it on to the toolbar and click on Done button.
The
Selenium IDE button can be seen on the toolbar as shown below
Go to http://www.seleniumhq.org/download/
and download the latest version by clicking on the version link. Here in this
case, it is 2.5.0
Firefox will protect you from installing add-ons from
unfamiliar locations, so you will need to click ‘Allow’ to proceed with the
installation, as shown in the following screenshot.
When downloading from Firefox, you’ll be presented with the
following window.
Select Install Now. The Firefox Add-ons window pops up,
first showing a progress bar, and when the download is complete, displays the
following.
Restart Firefox. After Firefox reboots you will find the
Selenium-IDE listed under the Firefox Tools menu.











awesome blog keep blogging about selenium
ReplyDeleteSelenium Training institute in Chennai