Thursday, 2 July 2015

Basics of Web application automation in Selenium


1.What kind of applications will selenium automates?

Selenium used to automate only Web applications.

2.What typical web application contains?

Web application contains web elements such as forms, links, frames, labels, web tables and so on.

3.What is the first step to automate?

The First Step to automate any web application is to invoke a web browser.

Say I want to open Google page in a browser and search for a key word ‘automation testing’
Below are the Steps we follow.
  • Open a browser (like IE, Firefox, Chrome..).
  • Enter URL ‘http://www.google.com'.
  • in the Search text box type the key word ‘automation testing’.
  • Click on 'Google Search' button.
To do above steps first thing we have to invoke a WebDriver and navigate to a URL http://www.google.com.

We need basic oops concept Inheritance to understand the keywords such as Interface,Class and Sub Class you can search in online to understand about inheritance. 

To Invoke Browser Selenium provides WebDriver Interface and below two implementation classes

  • RemoteWebDriver 
  • HtmlUnitDriver
And further we have a specific implementations sub classes for RemoteWebDriver specific to each browser

For example for Firefox browser we have sub class FirefoxDriver like wise below are the different browser specific implantation sub class’s for RemoteWebDriver.


 Browser                                Implementation Sub Class
 Mozilla Firefox                   FirefoxDriver

 Internet Explorer (IE)         InternetExplorerDriver

 Google Chrome                  ChromeDriver

 Opera Safari                     SafariDriver 

 Devices                                 Implementation Sub Class
 Android                            AndroidDriver

 Iphone                             IPhoneDriver


By Defaults Selenium supports Mozilla Firefox browser if you want to use other browsers we have to download respective browser drivers and use them in the tests.

 To Invoke FirefoxDriver browser we can use below statement in selenium webdriver.

 IWebDriver driver = new FirefoxDriver(); 

here we instantiate the Firefox implementation of the WebDriver interface and below are details of each keyword.

IWebDriver- Interface
driver = object of FirefoxDriver
New = keyword to create the object of a class
FirefoxDriver= Sub class of RemoteWebDriver

We will discuss more about methods of WebDriver and Locators in next article.




No comments:

Post a Comment