Complete Guide To Object Oriented Concepts in Selenium Automation Framework

Complete Guide To Object Oriented Concepts in Selenium Automation Framework

In almost all of the Automation interview you may have face this question where you have actually used OOPS Concept in your Automation framework.
So In this blog, we will discuss how and where we have actually applied below OOPs concepts in our Automation Framework.

  •         INTERFACE
  •         ABSTRACTION
  •         INHERITANCE


An interface in the Java programming language is an abstract type that is used to specify a behavior that classes must implement. An interface also contain methods and variables just like the class but the methods declared in interface are by default abstract.

To understand this the very basic statement we write in Selenium
WebDriver driver = new Chromedriver();

In this Case WebDriver itself is an Interface. So based on this statement, WebDriver driver = new Chromedriver(); we are initializing chrome browser using Selenium WebDriver. It means we are creating a reference variable (driver) of the interface (WebDriver) and creating an Object. Here WebDriver is an Interface as mentioned earlier and Chromedriver is a class.


As we are aware, Abstraction is a process of hiding the implementation details from the user and showing only relevant details to them. It also helps to reduce programming complexity and effort.

In our Automation Framework whenever we Use Page object Model, we write all the locator in page class and use this locator in our test it means we are hiding our implementation from the user this is the simple example of using abstraction in framework.


The process by which one class acquires the properties (instance variables) and functionalities of another class is called inheritance.

When We create a Base Class in our automation Framework to initialize WebDriver interface, waits,loggers,reports etc. and when we extend this Base Class in other classes such as Tests and Utility Class. In this case extending one class into other class is example of implementing Inheritance.


Encapsulation is a mechanism of wrapping data (variables) and code together as a single unit.
All the classes which we write in our automation framework are an example of Encapsulation. 

For e.g In Page object model classes, in which we declare the WebElement locator using @FindBy and initialization of this data members will be done using Constructor to utilize those in test methods.


If a class has multiple methods having same name but different in parameters, it is known as Method Overloading.

In Implicit wait when we use different time stamps such as SECONDS, MINUTES, HOURS etc is one of the possible example of method overloading.


If subclass or child class has the same method as declared in the parent class, it is known as method overriding in Java. 

Whenever we use a method which was already implemented/written in another class by changing its parameters this is the example of method overriding.

Keep Learning, Keep Sharing



My Name is Ankur Jain and I am currently working as Automation Test Architect.I am ISTQB Certified Test Manager,Certified UI Path RPA Developer as well as Certified Scrum Master with total 12 years of working experience with lot of big banking clients around the globe.I love to Design Automation Testing Frameworks with Selenium,Appium,Protractor,Cucumber,Rest-Assured, Katalon Studio and currently exploring lot in Dev-OPS as well. I am currently staying in Mumbai, Maharashtra. Please Connect with me through Contact Us page of this website.

Previous Post
Next Post
October 6, 2018 at 8:42 AM

Good Explanation.....bro

October 6, 2018 at 9:32 AM

Thankyou ankur..very helpful..

October 6, 2018 at 9:46 AM

Nice very helpful for interview

October 6, 2018 at 5:58 PM

nice and helpful.
Can you also share some tips for cracking selenium interview ?

October 8, 2018 at 10:44 PM

Wow amazing .. !!! Thanks for sharing

October 12, 2018 at 4:48 PM

Thank you ankur..very helpful :)

October 12, 2018 at 4:50 PM

Can you make one Post for Frequently asked Java programs in Interviews

May 29, 2019 at 7:02 AM

Can you please check the overriding section, I think if we change the parameter, it will be overloading not overriding but great article anyways.

November 8, 2019 at 4:44 PM

You missed the example for overriding. You only explain the definition.

But article is good. Thanks for writing this for us.

April 17, 2020 at 8:00 PM

Hi Ankur,
Can you please share any good framework for Appium mobile automation. Facing challenge to run TestNG tests on multiple emulators/ physical device where multiple apps need to launch for testing. How to manage this using framework. Also observe that Appium community is not so active to upgrade these types of challenges.
1. Problem in detecting if adb devices is up and running (USB debugging should be enabled).

May 15, 2020 at 11:15 AM

I must thank you for the efforts you have put in penning this site. I am hoping to check out the same high-grade content by you later on as well. Keep up the good work
software testing services
software testing companies
Security testing services
Test automation services

September 23, 2020 at 4:15 PM

It's great to be here and to learn more about software testing. I'm a software tester in a leading Software testing companies. This a great knowledge for all beginners. Appreciate your effort to write about this.