Monday 18 February 2013

Selenium WebDriver Introduction


This blog contains the information about Selenium WebDriver using java and hope you will get the very good start about selenium webdriver. I have also created multiple scripts which will help to understand the functionalities. All the examples are created using TestLink (TestCase Management Tool) Web application. I have also written the steps to configure Testlink

Introduction

Selenium is a browser automation tool, commonly used for writing end-to-end tests of web applications. A browser automation tool does exactly what you would expect: automate the control of a browser so that repetitive tasks can be automated.
At a very high level, Selenium is a suite of three tools –

  • Selenium IDE- Extension for Firefox that allows users to record and playback tests. The record/playback paradigm can be limiting and isn't suitable for many users.
  •  Selenium RC/WebDriver - Provides APIs in a variety of languages to allow for more control and the application of standard software development practices.
  • Selenium Grid- Use the Selenium APIs to control browser instances distributed over a grid of machines, allowing more tests to run in parallel

Selenium is a popular test framework for web applications, which runs on multiple browsers and can be developed using multiple programming languages. The primary new feature of Selenium 2 is the integration of WebDriver, a rival web application testing framework to Selenium 1 (a.k.a. Selenium RC). While Selenium RC runs a JavaScript application within the browser, WebDriver controls the browser directly using native browser support or browser extensions.
Selenium 1.0 aka Selenium RC
Selenium 1.0 consist 2 components. 
  • Selenium Core = Set of pure JavaScript commands
  • Selenium RC = Selenium RC Server + Selenium RC Client Lib
o   Selenium RC Server = Proxy server to handle the passing commands to webpage and interpreting the commands
o   Selenium RC Client Lib = Language bindings to write the tests in different favorite languages
In order to execute the JavaScript commands on the web page i.e. Selenium Core commands, the actual Selenium-core JavaScripts should be loaded on the page in which AUT is loading. Also we should make the browser feel as the commands also loading from the same domain from which AUT also loading.
So we are making a proxy server service called Selenium Server which internally loads our selenium core scripts to the AUT page.
As this is pure JavaScript execution on the web page, we have drawbacks like HTTP to HTTPS transformation handling, Browser dialogs handling for various browsers, handling iframes/frames, Security popups, some Keyboard/Mouse events etc
Selenium 2.0 aka WebDriver
Selenium 2.0 consists,

  • WebDriver API - Native browser API for each browser.
  •  Selenium Client Lib

Selenium commands directly interact with browser API. Browser API will interact with browsers via DOM structure after receiving selenese commands from client lib (which are test programs written by us). That’s why for each kind of browser they provided browser specific and supportive methods.
We have separate drivers like Internet Explorer driver, Firefox driver etc.


Please check the below tabs in more details- 

5 comments: