Selenium WebDriver – Architecture

I Try to Simplify as much as possible to understand how the architecture of Selenium formed.
Selenium WebDriver Divided into 3 major divisions
1. Language level Bindings
2. Selenium WebDriver API
3. Drivers
Language Level Bindings
We have a common API that has a common set of commands and we have various bindings for the different languages. So we can see there’s Java, Python, Ruby, etc..There’s also some other bindings and new bindings can be added very easily.
Selenium WebDriver API
Now these bindings communicate with Selenium WebDriver API and this API send the commands taken from language level bindings interpret it and sent it to Respective driver. In short term API contains set of common library which allow sending command to respective drivers.
Internet Browser Specific Drivers such as IE, FF, Chrome etc..It works in headless mode which makes, text execution faster. It also contains mobile specific Drivers. The basic idea is each one of these drivers knows how to drive the browser that it corresponds to. For E.g. Chrome Driver knows how to handle the low level details of chrome driver and drive it to do things like clicking the target element, navigating the target page etc...
How it’s working:
You are writing your test in Java using common selenium API and that Java binding is sending commands across this common API. Now on the other end is listening a driver, it interpret those commands and executing them on the actual browser and return result backup using the API.

Selenium Webdriver - Page Object Model

Developing a maintainable automation code is one of the keys to a successful test-automation
project. Test-automation code needs to be treated as production code and similar standards
and patterns should to be applied while developing this code.
While developing Selenium Web Driver tests, we can use the Page Object model pattern. This
pattern helps in enhancing the tests, making them highly maintainable, reducing the code
duplication, building a layer of abstraction, and hiding the inner implementation from tests.
Using the Page Object Model

WebDriver - Capturing Screen shot

By Using the TakeScreenhot Interface WebDriver will Capture the webpage this will help when test run and exceptional errors during execution.
Sample Code:
public void testScreenshot()
try {
File scrFile = ((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE);
FileUtils.copyFile(scrFile, new File("c:\\Screeshots\\Loginpage.png"));
} catch (Exception e) {
How It Works....

WebDriver - Automating Dropdowns Using Select Class

WebDriver supports Automating Dropdown and List controls using a special "Select" class instead of the WebElement class.
Let's create a test for a Dropdown control. This test will perform some basic checks and then call various methods to select options in dropdown.
Sample Code:

Selenium Automation Framework Design

To design a framework we need to concentrate on the following factors.
1. We need to create UI Map
2. Libraries for UI objects.
3. Design classes based on application under test.
4. Plan for test execution approach to minimize the time.
5. Design report generation.
6. Prepare a Step table and step suite.
7. Prepare a Data set where ever needed
8. Design Keyword Driven action fixtures
9. Design and develop the psudo code.

Simple Startup in Web Driver

Web driver is a java interface which is having lot of implementing classes and functions which we can refer from javadocs in selenium official site.

Download latest java client version from Its a zip pack, Unzip and go to eclipse Create new java project and right click on java project and select Build Path ---> Configure build path Click "Add External Jars" and select all the jar under the unzipped folder. Then click OK.

Selenium IDE - parametrization

Parametrization is one of the key area in Test automation. We have to design and develop the maximum combination of test data to give as input. This is one of the main reason we are moving to RC. But it can be possible in Selenium IDE too.

Steps to invoke the data file in to Selenium IDE