0% found this document useful (0 votes)
1 views4 pages

Page Object Model

The document explains the Page Object Model (POM) in Selenium, detailing its purpose, types, and related concepts such as annotations and POJO classes. It covers the folder structure used in POM, the differences between @FindBys and @FindAll annotations, and the use of @CacheLookup for optimizing WebElement access. Additionally, it highlights the significance of the Project Object Model (POM) in Maven for project configuration and management.

Uploaded by

MEERA SUPERSTORE
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)
1 views4 pages

Page Object Model

The document explains the Page Object Model (POM) in Selenium, detailing its purpose, types, and related concepts such as annotations and POJO classes. It covers the folder structure used in POM, the differences between @FindBys and @FindAll annotations, and the use of @CacheLookup for optimizing WebElement access. Additionally, it highlights the significance of the Project Object Model (POM) in Maven for project configuration and management.

Uploaded by

MEERA SUPERSTORE
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/ 4

PAGE OBJECT MODEL

QUESTIONS(Theory)
1. What is meant by POM?
*Page Object Model, also known as POM, is a design pattern in Selenium that creates an object
repository for storing all web elements.
*It is useful in reducing code duplication and improves test case maintenance.
2. What are the types of POM?
*With PageFactory
*Without PageFactory
3. What is meant by Annotations?
Annotations are the lines of codes that can control how the method below them will be executed.
*They are used to provide supplement information about the program.
*Annotation Start with "@" Annotation do not change action of a compiled program .
*Annotation help to associate metadata to the program elements i.e. instance variable,
constructors, methods, classes.
list of annotations
@FindBy
@FindBys
@FindAll
@cacheLookup
4. What are the page factory Annotations?
In Page Factory, Annotations are used to give descriptive names for WebElements to improve
code readability. And annotation @FindBy is used to identify Web Elements in the page.
*PageFactory is a way of implementing the “Page Object Model”.
*Here, we follow the principle of separation of Page Object Repository and Test Methods.
*It is an inbuilt concept of Page Object Model which is very optimized.
5.What is mean by pojo class?
*POJO stands for Plain Old Java Object. It is an ordinary Java object, not bound by any special
restriction other than those forced by the Java Language Specification and not requiring any
classpath.
*POJOs are used for increasing the readability and re-usability of a program.
*POJOs have gained the most acceptance because they are easy to write and understand.

6.How will you generate the pojo class?


public class Employee {

public String EmpName;


public String EmpAddress;

public Employee(String EmpName, String EmpAddress ) {


this.EmpName = EmpName;
this.EmpAddress = EmpAddress ;

}
//generate the getter
public String EmpName() {
return this. EmpName+ " " + this.EmpName;
}
public String EmpAddress() {
return this.EmpAddress+ " " + this.EmpAddress;
}
}
7.Write the folder Structure used in POM?
*maven-project/pom. ...
*maven-project/src/main – contains source code and resources that become part of the artifact.
*maven-project/src/test – holds all the test code and resources.
*maven-project/src/it – usually reserved for integration tests used by the Maven Failsafe Plugin.

8.What is the difference between @FindBys and @FindAll?


*FindBys is used to mark a field on a Page Object to indicate that lookup should use a series of
@FindBy tags in a chain as described in ByChained.
*It can be used on a types as well, but will not be processed by default.
* We can pass more than one locator it behaves like AND operator.
*If any one locator mistakes it will not enter the value, instead it will throw no such Element
Exception

Example
@FindBy
@FindBy(id="email")
private WebElement txtUserName;

@FindBy(id="pass")
private WebElement txtPassword;

@FindBy(name="login")
private WebElement btnClicklogin;

@FindAll
* We can pass more than one locator it is behaviour like OR operator.
*If any one locator mistakes it will enter the value.
@FindAll
@FindBy(id="email")
private WebElement txtUserName;

@FindBy(id="pass")
private WebElement txtPassword;

@FindBy(name="login")
private WebElement btnClicklogin;

9.What is the use of POM?


*A Project Object Model or POM is the fundamental unit of work in Maven.
*It is an XML file that contains information about the project and configuration details used by
Maven to build the project.
*It contains default values for most projects.
*The POM contains information about the project and various configuration detail used by
Maven to build the project(s).
* POM also contains the goals and plugins.

10.What are the use of @cacheLookup?


PageFactory annotation @CacheLookup is used to mark the WebElements once located so that
the same instance in the DOM can always be used.
CacheLookup attribute can be used to instruct the InitElements() method to cache the element
once its located and so that it will not be searched over and over again.

You might also like