Difference between page object model and page factory


When I started learning concerning the chemical element Automation Framework, I used the words “Page Object Model” and “Page Factory” interchangeably. Later, I understood the core distinction between them. Let American state share my information and can learn along.

Comparison of page object model and page factory:

s. No Page object model Page factory
1 It is Associate in Nursing approach for style patterns. It’s a category that’s provided by Se Web driver.
2 It’s not Associate in Nursing optimum technique to method tasks. It’s Associate in Nursing optimum technique to method tasks.
3 It helps in separating page objects and scripts. It’s a method to implement pommes.
4 ‘By’ annotation is employed to outline page objects. It uses annotation ‘Find By’ to explain page objects.
5 It doesn’t handle exceptions with efficiency. It with efficiency handles the exceptions.
6 It needs the data format of each object. It doesn’t need the data format of each object.
7 There’s cache storage for playacting tasks. There’s no would like for cache storage.


What is Page Object Model style clog (POM)?

Page Object Model may be a style Pattern that has become standard in atomic number 34 check Automation. It’s wide used style pattern in atomic number 34 for enhancing check maintenance and reducing code duplication. Page object model (POM) is often utilized in any reasonably framework like standard, data-driven, keyword driven, hybrid framework etc.  A page object is Associate in nursing object-oriented category that is Associate in nursing interface to a page of your Application beneath Test (AUT). The tests then use the ways of this page object category whenever they have to move with the interface (UI) of that page. The profit is that if the UI changes for the page, the tests themselves don’t have to be compelled to amendment, solely the code at intervals the page object has to amendment. Later, all changes to support that new UI is found in one place.

What is Page Factory?

We have seen that ‘Page Object Model’ may be a means of representing Associate in Nursing application in an exceedingly check framework. For each ‘page’ within the application, we tend to produce a Page Object to reference the ‘page’ whereas a ‘Page Factory’ is a technique of implementing the ‘Page Object Model’.

Main difference between page object model and page factory:

A Page Object Model may be a check style pattern that says organizes page objects as per pages in such some way that scripts and page objects is differentiated simply. A Page manufactory is a way of implementing Page Object Model that is built-in in Se.

In POM, you outline locator’s victimization ‘By’ whereas in Page manufactory, you employ Find By annotation to outline page objects.

Page Object Model may be a style approach whereas Page Factory may be a category that provides implementation of Page Object Model style approach.

POM isn’t optimum because it doesn’t give lazy data formatting whereas Page manufactory provides lazy data formatting.

Plain English person won’t facilitate in Stale Element Reference Exception whereas Page manufactory takes care of this exception by relocating net component whenever it’s used.

In plain page object model, you wish to initialize each page object severally otherwise you may encounter Null Pointer Exception whereas In Page Factory all page objects are initialized (Lazily) by victimization initElements () technique.