0% found this document useful (0 votes)
38 views2 pages

Code Maintainability - There Is A Separation Between Test

The Page Object Model (POM) is a design pattern that creates page class files corresponding to application web pages. Each page class finds the page's web elements and contains methods to perform actions on those elements. The methods are named according to the tasks they perform to indicate functionality. POM provides code reusability, maintainability through separation of test code from page code, and readability through clean separation. The PageFactory pattern extends POM by initializing web elements in Page Objects using annotations to automatically find elements without specifying findElement. PageFactory initializes elements when creating a Page Object instance to interact with elements within the object.

Uploaded by

Nikhil Dandge
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
38 views2 pages

Code Maintainability - There Is A Separation Between Test

The Page Object Model (POM) is a design pattern that creates page class files corresponding to application web pages. Each page class finds the page's web elements and contains methods to perform actions on those elements. The methods are named according to the tasks they perform to indicate functionality. POM provides code reusability, maintainability through separation of test code from page code, and readability through clean separation. The PageFactory pattern extends POM by initializing web elements in Page Objects using annotations to automatically find elements without specifying findElement. PageFactory initializes elements when creating a Page Object instance to interact with elements within the object.

Uploaded by

Nikhil Dandge
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

PageObjectModel

 In POM, for each web page in the application, there should be


corresponding page class.
This Page class will find the WebElements of that web page and also
contains Page methods which perform operations on those
WebElements.
 For every action performed on the webElements there should be
equivalent method for them, also the name of these methods should be
given as per the task they are performing so that we can get to know the
functionality of the methods

Advantages

• Code reusability – We could achieve code reusability by


writing the code once and use it in different tests.
• Code maintainability – There is a separation between test
code and page specific code such as locators ,which
becomes very easy to maintain code
• Readability – Improves readability due to clean separation
between test code and page specific code
PageFactoryModel

 The PageFactory Class in Selenium is an extension to the Page Object


design pattern
 We use Page Factory pattern to initialize web elements which are
defined in Page Objects.
• Factory class gives us the ability to use annotations which automatically
find the elements on the page without specifying findElement
 Page Object is a class that represents a web page and hold the
functionality and members.
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.

You might also like