Expert Level Selenium Framework 2021

In this tutorial, we will learn exhaustively about the Test Automation framework and design and develop the Selenium framework from scratch to the advanced level.

Let’s break this series of tutorials into multiple modules to accomplish the Selenium Framework Development with Java from concept to advanced level.

Selenium Framework
Automation Framework

Types of the Selenium Framework and their Features

Different types of Selenium Framework are designed and built considering the Application needs that you want to automate. Every different type of test Automation framework is having different features and advantages/disadvantages.

We can classify the Selenium Framework in the below areas :

  • Keyword Driven Test Automation framework 
  • Data driven Test Automation framework.
  • Hybrid framework 
  • Page Object Model Test Automation framework 
  • Hybrid Page Object Model Test Automation framework 
  • Behavior driven development (BDD) Test Automation framework 

Test Automation Selenium Framework Features

Keyword Driven Framework in Selenium

What is keyword driven framework?

Keyword Driven Framework in selenium is a Selenium framework built around the feature or design where the Keyword drives the framework; we will see how. 

How Keyword Driven framework Works : 

As mentioned above, KDF is dependent or designed based on Keywords, So what is a keyword? 

Keywords are nothing but the web action words (like click, type, mouseHover, switchFrame etc. ), now you store these keywords in Some repo (or let’s say in Excel files) and for all the keyword’s actions you define a class (which is WebAction utility using Selenium commands ) and write specific methods for Specific Keywords.

Now the next step is basically from your script when you mention let’s say click on some webelement then, in that case, the respective operation goes to the Keyword’s repo (here in our case Excel and then depending on the operation it calls the respective methods which you had defined in the class ).

Additionally, You have different reporting mechanisms (let’s say reportNg or Allure report ) which you can integrate with your Selenium framework to take care of the reporting.

keyword driven framework advantages

  • KDF is easy to design and Develop 
  • Complexity and cyclomatic complexity is not that high 
  • Easy to maintain and debug.
  • Building KDF takes lesser effort and time and is controlled from a single triggering point by the Keywords.

keyword driven framework disadvantages 

  • KDF is not an exhaustive and advanced framework and lacks many advanced features of a framework that we will discuss later.
  • Integration with various open-source Tools is not that flexible enough.
  • Can not be supported widely with various Data Driven frameworks, i.e. that framework which is driven and required to handle complex data such as Image text, YML, PDF.
  • Keyword driven framework is not as secure as a Hybrid or Page Object model framework.

Data driven framework in Selenium 

What is Data driven framework?

Data Driven framework in selenium is a type of Selenium framework which is built around the feature or design where the data drives the framework; we will see how :

How Data Driven framework Works

Data Driven Framework is designed to handle complex and various type of Data to perform the Automation of the application.

This kind of framework is useful and built where your automation scenarios and use cases must be tested with various sets of data on the same functionalities.

So Data drives the flow of Automation where same test scenarios are tested with respect to different data sets, and DDF should be able to handle various types of Data such as Excel, CSV, YML, PDF, Text, DataBase, Image Data etc.

So you can use TestNG data provider, TestNG XML parameterized Data, JDBC connection manager, PDF data handler, YML data handler. 

You can use Tesseract OCR for working with image data handling.

Data driven framework advantages 

  • The Data Driven framework is very versatile and robust in terms of working with multiple types of Data format.
  • The same script can be handled to run with different cases /corner cases with just adding various boundary conditioned data sets.
  • Easy to maintain and debug.
  • Can handle complex automation scenarios

Data driven framework disadvantages

  • DDF’s design is tightly coupled.
  • Once the framework is built is less likely to have support for new and critical enhancement in terms of Automation areas or tools. Which means enhancement is not straight forward.
  • Less flexible and less secure compared to Hybrid Selenium framework or Page Object Model framework.


Hybrid framework in Selenium Automation

What is Hybrid framework?

Hybrid framework in selenium is a type of Selenium framework which basically is built around the feature or design by taking the concept of both Keyword driven and Data driven framework. 


Hybrid Framework => Data Driven Framework + Keyword Driven framework.

How Hybrid Framework Works

The hybrid framework supported and driven by Keyword Driven approach with the capability to handle Data driven testing, so both the features are enabled with Keywords repository and their implementation and along with Various Data providers and Dala handlers which is the core feature of the Data Driven Framework.

Page Object Model – Test Automation framework

What is Page Object Model 

Page Object Model framework as the name suggests, is basically a Selenium framework design and developed around the below features and concepts :

  • The whole Web Application is divided into the different Webpages, and if sometimes each webpage has enormous functionalities, it’s even further broken down to different Page Modules based on the functionalities. 
  • Now every Page or Page modules represents a separate Class(Java class).
  • Every page functionalities (e.g., login, sign up etc. for the Landing Page) represents different methods in the Java class, which in trunks represents the different Page methods.
  • The page locators are nothing but the locators for the respective pages/modules and developed and stored either by Classic Page Factory or the customized Page Object Model.
  • From the Unit Test Framework(@test method) basically, we call different Page methods (by creating the objects of Page classes)and eventually different page methods again calls the page locators(Web elements of that Webpages ) 

Why Page Object Model || Advantages of a page object model

Page Object Model framework design is one of the latest framework model used in the industry, and it comes up with various advance features along with it  

  • As the Whole Web Application is divided into multiple webpages/page modules and eventually different Java Page class and page methods hence its easier to maintain and debug the code in a centralized manner. So in case of any changes in the specific page functionalities we only have to maintain the specific method.
  • Page Locators are stored in the Specific location respective to Pages /modules, hence its easier to main and debug and also in case of any change in the Web elements.
  • Page object Model provides the best security model in terms of Automation framework level as the Page layers loosely coupled and centralized code (for respective page classes).
  • With Page Object Model framework design, you can exhaustively support and enhance your existing framework without changing much on the design and keep on adding framework utilities and components along with it to handle different integration.
  • Integration of the third-party tools and tech stack is also flexible.
  • Different reporting tools and features can be plugged in and can be managed and controlled in a better way with the Page Object Model design.
  • You can design the Page Object model using the classic page Factory concept or with the implementation of the interface. 

We will see how to design the exhaustive Page Object Model framework here.

Hybrid Page Object Model Selenium framework

Hybrid Page Object Model framework is designed with an approach where its the combination of Data driven Framework and Page Object Model framework.

Here in the Hybrid Page Object Model framework, the Core Design is based on the Page Object model and uses the vast data handler to work with Data-Driven Testing.

We will Design the Hybrid Page Object model Framework here. 

Behavior driven development (BDD) Test Automation framework 

BDD framework is a Selenium framework where the design and the flow of Automation are driven by the behaviour.

What is BDD framework? 

BDD framework is controlled or designed based on the behaviour of the test cases or actions performed. 

In BDD framework, we use English like language called Gherkin language, which is the driving point of the framework. 

Gherkin language is basically in the format of given, when, then (where given narrates a precondition when means when you perform some operation on some webelement like let’s say click operation etc. and then is basically for assertion )

Tools and Technologies required for the Automation Framework

Selenium is an open-source tool, and it does not provide any inbuilt framework along with. Hence you need to design and develop the Selenium framework along with Tools and technologies. 

You could use the tools to work with Selenium framework Development

  • Eclipse/Intellij Idea (as a development IDE)
  • Jenkins(as a CI tools if you want to build CICD pipeline with Automation)
  • Maven/Gradle/Ant (as a build tool)
  • TestNg/JUnit (as a Unit Test Framework )
  • Selenium Bundles/Jars (as Selenium dependencies)
  • Java/C#/Python(as the language)
  • ReportNg/Extent Report/Allure (for Reporting features)
  • ELK stack (if you want to build advanced REAL TIME REPORTING)
  • Graylog (if you want to build advanced real time logging dashboard else you can use Log4J etc.)
  • Tesseract OCR technologies for Image recognition and Image Text Automation 
  • Fontbox ,Pdfbox for PDF data handling capabilities
  • Apache POI for Excel data handling
  • Sikuli/AutoIt for handling Native App Automation Automation cases.
  • TestLink /Jira client libraries for the purpose of TestCase Management tools integration with your Automation framework 

These are the majorly and frequently used Tools and tech stack to build a robust Selenium framework. 

Conclusion: This tutorial We had an overview of the Selenium Automation framework and what are features of a Selenium framework and what tools are required to build a Robust Test Automation Framework, in the upcoming tutorials we will discuss about the Design Principles and design patterns to build a Selenium framework and eventually we will end up creating a framework hands on which you could use at your own approach. To learn about the whole Selenium tutorial you can visit here and for Critical Selenium Interview Questions click here.

About Debarghya

Myself Debarghya Roy, I am an Engineering ARCHITECT working with fortune 5 company and an open source contributor, having around 12 years of experience/expertise in various Technology stack.
I have worked with various technologies such as Java,C#,Python,Groovy, UI Automation(Selenium), Mobile Automation(Appium), API/Backend Automation,Performance Engineering(JMeter, Locust), Security Automation(MobSF,OwAsp,Kali Linux, Astra,ZAP etc), RPA,Process Engineering Automation,Mainframe Automation,Back End Development with SpringBoot,Kafka,Redis,RabitMQ,ELK stack, GrayLog, Jenkins and also having experience in Cloud Technologies, DevOps etc.
I live in Bangalore ,India with my wife and have passion towards Blogging , music , playing guitar and my Philosophy of life is Education for All which gave the birth of LambdaGeeks. Lets connect over linked-in -

Leave a Comment

Your email address will not be published. Required fields are marked *