0% found this document useful (0 votes)
34 views3 pages

POM (Page Object Model)

Uploaded by

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

POM (Page Object Model)

Uploaded by

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

POM(Page object Model):

• It is an object repository
Why repository?
As per the role of automation we should not hardcode
the element in test scripts, instead we should get
elements from object repository, because in a Agile
process, due to frequent requirement changes
modifications and maintenance of elements is tedious
job.

What is object repository/ element repository?


It is a collection of elements locators and business
libraries in one place and its shared by multiples.

What is POM Design pattern?


It is a Java design pattern, preferred by Google to
maintain elements in well organised way

What is page factory Design pattern?


It is an extended version of POM design pattern, which
is used to access the elements available in form.

Advantages of POM?
• We can handle stale element reference exception.
• Reusability of element, no need to write Xpath again
and again.
• Modifications in repository is easy, when GUI
changes frequently.
• Maintenance of elements is easy because all
elements are kept in one place
• More readability

What is stale element reference exception?


Whenever the address of an element got expired we
will get stale element reference exception.

There are three stages in POM


1. Declaration
2. Initialization
3. Utilization
Declaration:
We declare the elements through below syntax

@FindBy(locator=”value”)
Private webElement component name;

Initialization :

Here we have to create a constructor shown as below

Public Constructor(WebDriver driver)


{
PageFactory.initElements(driver,this);
}

Utilization:
We are going to create simple method.

Public void demo()


{
componentName.action;

Rules for POM:


• Class name should be same as page name.
• For every new page we have to create new class
• Except typing and clicking we need to generate
getter and setter methods.

You might also like