What are the differences between POM and PageFactory in Selenium Webdriver

0 votes
What are the differences between POM and PageFactory in Selenium Webdriver?
Jul 17, 2019 in Selenium by Raveena
28,466 views

1 answer to this question.

0 votes

Hi Raveena, Page Object Model (POM) and Page Factory has following differences:

  1. 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. A Page Factory is one way of implementing PageObject Model which is inbuilt in selenium.
  2. In POM, you define locators using ‘By’ while in Page Factory, you use FindBy annotation to define page objects.
  3. Page Object Model is a design approach while PageFactory is a class which provides implementation of Page Object Model design approach.
  4. POM is not optimal as it does not provide lazy initialization while Page Factory provides lazy initialization.
  5. Plain POM will not help in StaleElementReferecneException while Page Factory takes care of this exception by relocating web element every time whenever it is used.
  6. In plain page object model, you need to initialize every page object individually otherwise you will encounter NullPointerException while In PageFactory all page objects are initialized (Lazily) by using initElements() method.
For further understanding, you can refer to the Selenium Certification.
answered Jul 17, 2019 by Anvi
• 14,150 points

Related Questions In Selenium

0 votes
1 answer

What are the differences between getText() and getAttribute() functions in Selenium WebDriver?

See, both are used to retrieve something ...READ MORE

answered Apr 5, 2018 in Selenium by nsv999
• 5,500 points
16,940 views
0 votes
2 answers
+1 vote
1 answer

What are the similarity between Selenium RC and Selenium Webdriver?

Selenium RC and Webdriver both support the ...READ MORE

answered Dec 12, 2018 in Selenium by Priyaj
• 58,090 points
909 views
0 votes
1 answer

What is Xpath and what are the types of it in Selenium Webdriver?

Hi Piyush, XPath is defined as XML path. It is ...READ MORE

answered May 9, 2019 in Selenium by Pratibha
• 3,690 points
5,063 views
0 votes
2 answers

Finding WebDriver element with Class Name in java

The better way to handle this element ...READ MORE

answered Apr 10, 2018 in Selenium by nsv999
• 5,500 points
12,617 views
0 votes
2 answers

Problem while using InternetExplorerDriver in Selenium WebDriver

enable trusted connection  in internet explorer by ...READ MORE

answered Aug 31, 2020 in Selenium by Sri
• 3,190 points
8,572 views
0 votes
1 answer

Geo-location microphone camera pop up

To Allow or Block the notification, access using Selenium and you have to ...READ MORE

answered May 11, 2018 in Selenium by Samarpit
• 5,910 points
6,629 views
0 votes
2 answers

How to use such xpath to find web elements

xpath are two types. 1) Absolute XPath:    /html/b ...READ MORE

answered Sep 3, 2020 in Selenium by Sri
• 3,190 points
7,519 views
+1 vote
2 answers

What is the difference between findElement and findElements in Selenium Webdriver?

FindElement Command -This method locates for the ...READ MORE

answered Feb 11, 2020 in Selenium by anonymous
8,019 views
0 votes
1 answer

What is the difference between getWindowHandle() and getWindowHandles() methods in Selenium WebDriver?

Hey Jennifer, difference between getWindowHandle() and getWindowHandles() ...READ MORE

answered Jun 4, 2019 in Selenium by Anvi
• 14,150 points
13,527 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP