What is the Main difference between Page Object Model and Page Factory in Selenium? (Download Code)
Pramod Dutta
Posted on October 16, 2020
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
Posted on October 16, 2020
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.
Related
October 16, 2020