Skip to content

Make Selenium Easy

And Keep It That Way

  • Home
  • Share
  • Toggle search form

Plain Page Object Model In Selenium Webdriver (Without PageFactory)

Posted on 01/14/2025 By admin

Hello Folks,

In last post, we have seen Introduction of Page Object Model in details.

In this post we will see how to implement page object model in selenium webdriver.

The main idea of POM is to separate web elements and test scripts to achieve one to many relationship. You define web element at single place and you can use that in many scripts. It makes maintenance of web elements easy if you want to modify or add new.

To achieve this, we can store web elements in a property file, an excel file, in a java class or in table of database. In this post, we will store web elements in a java class file.

POM does not say anything specifically on categorization of web elements but it is good practice to group web elements as per web page name. For example: Web elements present on login page should be stored in LoginPage.java class and web elements on registration page should be stored in RegistrationPage.java. Advantage of this approach will be easy accessing of web elements.  You just need to navigate to LoginPage.class to access login page web elements.

We will implement POM for below scenario:

  1. Access this URL.
  2. Click on Sign In button which is in Home page.
  3. Type Email Address in Email Address text box which is in Login page.
  4. Type password in Password text box which is in Login page.
  5. Click on Sign In button which is in Login page.

In above scenario, we will access two web pages “Login” and “Home” pages. So, we will create two java class: HomePage.java and LoginPage.java.

There is another good practice in POM is to keep actions/methods on web elements on same page. For example: You need to click on SignIn button. So, you should create a method clickOnSignButton method and keep in HomePage.java class.

Note: SignIn button is in LoginPage and HomePage both. POM helps you in distinguish similar web elements as well.

HomePage.Java:

LoginPage.Java:

TC_001_SignIn.java:

Disadvantages of Plain POM: 1. Its not optimized. More memory utilization.

2. No Lazy initialization.

Uncategorized

Post navigation

Previous Post: parameterised dataprovider
Next Post: How To Iterate Map In Java Using Stream and Lambda?

Related Posts

image – Make Selenium Easy Uncategorized
October 28, 2018 – Make Selenium Easy Uncategorized
image – Make Selenium Easy Uncategorized
Log4j2 tutorials Uncategorized
April 2017 – Make Selenium Easy Uncategorized
Reading Data From CSV in Postman Uncategorized

Recent Posts

  • Getting Started with Selenium 4: What Is New and How to Upgrade from Selenium 3
  • Manual Testing
  • Baby Steps To Become Efficient Selenium-Java Automation Tester
  • Features of Selenium 4.0.0 Release – Java Binding
  • Part 1: Handling Drop-down Created Using SELECT Tag In Selenium

Recent Comments

No comments to show.

Archives

  • April 2026
  • April 2025
  • March 2025
  • February 2025
  • January 2025
  • December 2024
  • November 2024
  • October 2024
  • September 2024
  • August 2024
  • April 2024
  • March 2024
  • February 2024
  • December 2023
  • October 2023
  • August 2023
  • November 2022
  • September 2022
  • August 2022
  • July 2022
  • May 2022
  • March 2022
  • October 2021
  • April 2021
  • March 2021
  • January 2021
  • December 2020
  • October 2020
  • September 2020
  • August 2020
  • June 2020
  • May 2020
  • April 2020
  • March 2020
  • February 2020
  • January 2020
  • December 2019
  • November 2019
  • October 2019
  • September 2019
  • August 2019
  • May 2019
  • December 2018
  • November 2018
  • October 2018
  • September 2018
  • August 2018
  • July 2018
  • January 2018

Categories

  • Getting Started
  • Uncategorized

Copyright © 2026 Make Selenium Easy.

Powered by PressBook Masonry Dark