DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’»

Cover image for What is the Main difference between Page Object Model and Page Factory in Selenium? (Download Code)
Pramod Dutta
Pramod Dutta

Posted on

What is the Main difference between Page Object Model and Page Factory in Selenium? (Download Code)

In this video, We are going to cover a very important topic for the Selenium interview and answers for experienced people, What is the main difference between Page Object Model and Page Factory in Selenium.

βœ… Download Mind Map - https://sdet.live/2CYx
βœ… Download Page Object Model with Page Factory : https://sdet.live/2CZ3

βœ… What is Page Object Model?
Page Object Model (POM) is a design pattern, mostly used in test automation with selenium that creates Object Repository or OR for web UI elements(with Page object Classes.

We use the Page Object model because it reduces code duplication and improves test maintenance.

There are two important things -
There should be a corresponding Page Class
Page methods which perform operations on those WebElements

βœ… Why Page Object Model?
Script maintenance
object repository is independent of test cases
Provides Structure to Automation Framework

βœ… What is Page Factory in Selenium?
Page Factory in Selenium is an inbuilt Page Object Model concept for Selenium WebDriver but it is very optimized.

It is used for initialization of Page objects or to instantiate the Page object itself. It is also used to initialize Page class elements without using "FindElement/s."

Here as well, we follow the concept of separation of Page Object Repository and Test Methods. Additionally, with the help of PageFactory class, we use annotations @FindBy to find WebElement. We use initElements method to initialize web elements

@FindBy can accept tagName, partialLinkText, name, linkText, id, css, className, xpath as attributes.

βœ… Download Mind Map - https://sdet.live/2CYx
βœ… Download Page Object Model with Page Factory : https://sdet.live/2CZ3

βœ… Want to become an Automation Rockstar ? https://thetestingacademy.com/

πŸ‘ͺ Join our Community - http://bit.ly/learntesting2019
βœ… Automation Community - https://thetestingacademy.com
🐦Follow us on Twitter - https://twitter.com/itstechmode
πŸ“– Like us on Facebook - https://www.facebook.com/scrolltest

🎀 Listen to our Podcast - https://anchor.fm/thetestingacademy

automationtesting #manualtesting #testautomation #thetestingacademy #scrolltest

πŸš€ Tools and services I recommend:
Some of the courses that I recommend to become better Automation Tester πŸ™ŒπŸ™Œ

βœ…API Testing -
https://www.learnapitesting.com

βœ…Cypress Tutorial with LIVE Projects -
http://cypresstutorial.com

Top comments (0)

🌚 Friends don't let friends browse without dark mode.

Sorry, it's true.