N
The Global Insight

What is the difference between POM and PageFactory

Author

Matthew Martinez

Updated on April 22, 2026

Page Factory is a way to initialize the web elements you want to interact with within the page object when you create an instance of it. 1.. POM is a Design pattern which segregates selenium code based on pages.

What is difference between PageFactory and pom?

Page Factory is a way to initialize the web elements you want to interact with within the page object when you create an instance of it. 1.. POM is a Design pattern which segregates selenium code based on pages.

What is the difference between Page object model and PageFactory?

A Page Object Model is a test design pattern which says organize page objects as per pages in such a way that scripts and page objects can be differentiated easily. … Page Object Model is a design approach while PageFactory is a class which provides implementation of Page Object Model design approach.

What is PageFactory in Pom?

PageFactory is a class that provides the implementation of the Page Object Model design pattern. In POM, one needs to initialize every page object individually. In PageFactory, all page objects are initialized by using the initElements() method.

Why is PageFactory used?

The PageFactory can be used to initialize elements of a Page class without having to use FindElement or FindElements. When you are using the webelement(s) more then once your code gets better readable.

What is POM in Selenium C#?

Page Object Model, also known as POM, is a design pattern in Selenium which has gained more popularity in the market for test automation development for the maintenance of code, such as reusability, extensibility, and avoiding code duplication etc.

What is POM in automation?

Page Object Model (POM) is a design pattern, popularly used in test automation that creates Object Repository for web UI elements. The advantage of the model is that it reduces code duplication and improves test maintenance.

What does pom stand for Maven?

A Project Object Model or POM is the fundamental unit of work in Maven. It is an XML file that contains information about the project and configuration details used by Maven to build the project.

Is PageFactory a class?

Page Factory is a class provided by Selenium WebDriver to implement the Page Object Model. The Page Object Repository is separated from the Test Methods using the Page Factory concept. Using it, you can initialize the Page Objects or directly instantiate them.

What is TestNG?

Definition: TestNG (Test Next Generation) is the testing framework. TestNG is inspired from JUnit and NUnit, but it has a new functionality that makes this framework more powerful and easier. TestNG is designed in such a way that it covers all the categories of tests comprising unit, functional and integration.

Article first time published on

How do you test Web pages and initialize using pom?

  1. Initialize the driver and open the application.
  2. Create an object of the PageLayer Class(for each webpage) and pass the driver instance as a parameter.
  3. Using the object created, make a call to the methods in the PageLayer Class(for each webpage) in order to perform actions/verification.

What are the advantages of POM framework in selenium?

  • It makes ease in maintaining the code (flow in the UI is separated from verification)
  • Makes code readable (Methods get more realistic names)
  • Makes the code reusable (object repository is independent of test cases)
  • The Code becomes less and optimised.

What is the drawback of the POM model?

Challenges of POM If there is an application with hundreds or thousands of web pages than the time and the effort in the development of automation framework will be high. The cost increases when maintenance overhead increases which are due to the maintenance of large class as they break the OO design principle.

What is Maven Selenium?

SeleniumAutomation TestingTesting Tools. Maven is Yiddish Word which means Accumulator of Knowledge. Maven is a tool which is used for building and managing Java Based Projects. Basically to put it in simple words is a way to manage dependency for Java Based Project.

Which language is not supported by Selenium?

ASP language is not supported by Selenium.

How do you explain poms in an interview?

POM stands for Page Object Model. It is a design pattern for creating an Object Repository for web UI elements. Every single web page in the application must have its own corresponding page class, which is in charge of searching the WebElements in that page and then execute operations on them.

How do you handle Staleelementreferenceexception?

  1. Solution 1: Refreshing the web page.
  2. Solution 2: Using Try Catch Block.
  3. Solution 3: Using ExpectedConditions. refreshed.
  4. Solution 4: Using POM.

How do you use poms in testNG?

  1. Create a maven project using IntelliJ or Eclipse IDE.
  2. Add testNG plugin as a maven dependency in pom. xml file. (Following code-snippet should be added in between “dependencies” tags in pom. xml and change the version of the plugin as your preference.)

What is PageFactory in Selenium C#?

The PageFactory in C# Class is an extension to the Page Object Design Pattern. It is an inbuilt POM concept for Selenium WebDriver but it is very optimized. It is used to initialize the elements of the Page Object or instantiate the Page Objects itself.

What can I use instead of PageFactory?

You can use Page Object Pattern without the PageFactory.

Is selectAllOptions () is a valid command?

In Selenium webdriver, selectAllOptions() is a valid command.

How do I use PageFactory in Python?

multiple – the answer to @FindBy for a list of elements. cacheable – the answer to @CacheLookup .

What is Ajax locator factory?

AjaxElementLocatorFactory is the lazyloading concept in Page Factory pattern to identify WebElements only when they are used in any operation i.e. a timeOut for a WebElement can be assigned to the Object page class with the help of AjaxElementLocatorFactory . Syntax: PageFactory.

What is groupId and artifactId?

The groupId is a parameter indicating the group or individual that created a project, which is often a reversed company domain name. The artifactId is the base package name used in the project, and we use the standard archetype.

What is parent pom?

Maven parent POM (or super POM) is used to structure the project to avoid redundancies or duplicate configurations using inheritance between pom files. … If any dependency or property is configured in both parent and child POMs with different values then the child POM value will take the priority.

What is school pom?

Production and Operations Management Society (POMS) is launching a workshop series targeted to and for the benefit of doctoral students who will be starting their job search in the fall.

Is TestNG only for Java?

TestNG is an open-source test automation framework for Java. It is developed on the same lines of JUnit and NUnit.

Is BDD a framework?

Behavior Driven Development (BDD) framework is a software development process that is an offshoot of Test Driven Development (TDD) framework. BDD is an agile testing methodology. It is the process of development, based on test-driven development and domain-driven, object-oriented analysis.

What is invocationCount in TestNG?

Invocation count determines how many times test will execute. For EX: Execute test 7 times. import org.testng.annotations.Test; public class MultipletimesRun { @Test(invocationCount=7)

What is the Maven project?

Maven is a build automation tool used primarily for Java projects. … The Maven project is hosted by the Apache Software Foundation, where it was formerly part of the Jakarta Project. Maven addresses two aspects of building software: how software is built, and its dependencies.

What is use of API testing?

API testing is a software testing practice that tests the APIs directly — from their functionality, reliability, performance, to security. Part of integration testing, API testing effectively validates the logic of the build architecture within a short amount of time.