What is Page Object Model (POM) in Selenium

  • by

What is Page Object Model (POM) -:
Page Object Model (POM) is a just design pattern not a framework in Maven used to create object repository for web UI elements. It is API to drive and interact with UI. Web page contains multiple pages one inside the other. Each web page corresponds to separate class. All pages of your AUT are mapped to a class file in your code and each method within the class file can be treated as a service offered by the POM.                                                                                                              An implementation of the POM can be achieved by separating the abstraction of the test object and the test scripts.

POM make non-brittle test code and reduce or eliminate duplicate test code building directory, which is target; the source directory, which is src/main/java; the test source directory, which is src/test/java to avoid duplication.

It improves the readability and allows us to create interactive documentation.

Advantages of POM -:
1] Script will be cleaner and more readable format
2] It is easy to understand
3] Easy to maintain
4] Easy to reusable
5] Simple to Mapping

POM Implementation -:
It can be implemented with the help of following two ways -;
I] Using normal approach
II] Using page factory and @FindBy

POM Design Structure -:
-PomwithTestNG  // Maven Project name
+JRE System Library[J2SE-1.5]
+Maven Dependancies

Leave a Reply