#1 India's Top IT Training Institute
×

About Uncodemy

Know more about who we are and what we stand for.

About Us

About Us

Discover our mission to equip individuals with essential IT skills and industry expertise.

Read More →
UnCodeMy Gallery

UnCodeMy Gallery

Explore highlights from our IT training sessions and success stories.

Read More →
Mentors

Mentors

Meet the industry experts who train and guide you through your course.

Read More →
Free Resources

Free Resources

Free tutorials, interview questions, tools and calculators to help you learn.

Explore →
×

Free Resources

Learn, practice and plan your career — bilkul free.

Tutorials

Tutorials

Step-by-step written tutorials to learn any technology at your own pace.

Read More →
Free Counselling

Free Counselling

Book a free video counselling session and pick the right course for you.

Read More →
Online Compiler

Online Compiler

Write, run and test your code online — no setup required.

Read More →
Selenium Frameworks

Types of Selenium Test Frameworks

Common Framework Types for Selenium

  • Modular Framework: breaks the application into independent modules/scripts, each testable in isolation.
  • Data-Driven Framework: separates test data from script logic, running the same test against multiple data sets.
  • Keyword-Driven Framework: represents test steps as reusable keywords, readable even by non-programmers.
  • Hybrid Framework: combines two or more of the above approaches.
  • Page Object Model (POM): represents each web page as a class, encapsulating its elements and actions.

How the Framework Styles Compare

Each style answers a different question: how to organise code, where to keep data, and who writes the tests. Most real projects end up mixing them, which is why the hybrid approach is so common.

FrameworkMain ideaStrengthWeakness
ModularSplit the app into small test modulesEasy to reuse and maintain piecesTest data still lives inside scripts
Data-drivenRead inputs from Excel, CSV or JSONOne script covers many casesNeeds good data management
Keyword-drivenSteps written as keywords in a tableReadable by non-programmersBuilding the keyword engine takes effort
Page Object ModelOne class per pageLocators change in one place onlyMany classes on large apps
HybridMix of the aboveFlexible for real projectsNeeds clear team conventions

Behaviour-driven development (BDD) with Cucumber is often added on top. Tests are written as plain-language Given, When, Then scenarios, and step definitions call page objects underneath.

A Page Object Model Example in Java

The page class hides locators and exposes meaningful actions. The test class reads like a description of user behaviour.

public class LoginPage {
    private final WebDriver driver;
    private final By username = By.id("username");
    private final By password = By.id("password");
    private final By loginBtn = By.cssSelector("button[type='submit']");

    public LoginPage(WebDriver driver) {
        this.driver = driver;
    }

    public DashboardPage loginAs(String user, String pass) {
        driver.findElement(username).sendKeys(user);
        driver.findElement(password).sendKeys(pass);
        driver.findElement(loginBtn).click();
        return new DashboardPage(driver);
    }
}

// In the test (TestNG)
@Test(dataProvider = "validUsers")
public void userCanLogIn(String user, String pass) {
    DashboardPage dash = new LoginPage(driver).loginAs(user, pass);
    Assert.assertTrue(dash.isLoaded());
}

Notice the hybrid idea already: the page object gives structure, and the TestNG data provider makes the same test data-driven.

Choosing a Framework for Your Project

  1. Look at who writes tests. If manual testers or business users contribute, keyword-driven or BDD layers help.
  2. Count the data variations. Forms with many input combinations benefit from data-driven design.
  3. Check how often the UI changes. Frequent UI changes make the Page Object Model almost essential.
  4. Plan reporting and CI early. Decide on a runner (TestNG or JUnit), a report tool and how the suite runs in the pipeline.

A typical folder layout separates concerns clearly: pages for page objects, tests for test classes, data for input files, and utils for driver setup, waits and screenshots.

Common Framework Mistakes

  • Putting assertions inside page objects, which makes them hard to reuse.
  • Using fixed Thread.sleep() calls instead of explicit waits.
  • Hard-coding URLs and credentials instead of reading them from configuration.
  • Building a keyword engine nobody maintains; start simple and grow only when needed.
  • Letting tests depend on each other's order, which causes random failures in parallel runs.

Ready to master real-world software testing?

Learn manual and automation testing hands-on with mentor-led sessions.

Explore Course