Advance Selenium WD

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

Q1-What is POM? How we can design POM?

(Unit design)

Ans-Page object model is a java design pattern, code reusability done to design POM we required
Encapsulation OOPs concept.

**For POM (Class) Design-

a) Declaration: In declaration we declare all the variables (Data member=> variables with Data type)
Globally, as access specifier private.

b) Initialisation: In this case we initialise variable (Assign the value as web element locator) in
constructor as access specifier public.

c) Usage: In this case we use setter method as access specifier public to write the code.

POM class doesn’t contain main method to run a POM class so we required another class with main
method for execution steps (Also Navigation step) i.e test class-

Q2-What are the disadvantage of POM?

Ans – Basically in POM class we are unable to find the hidden element present on web page .If we
try to locate that hidden component then it will show no such element exception so overcome to
this we have to use Page factory class

Q3) What is page factory class and why we are prefer to use?

Ans To inspect the hidden element on web page we have to use the page factory class.

-It contain static method like initElement method to Initialise web element
-Synatax --> Pagefctory.initElement (Argument1, Argument2)
-InitElement method: is use to initialised the data member by identifying each component
present in web page by using @findBy annotation ,which take locator type as an argument
Working (PageFactory)::
While executing test script initElement method will convert all the data member @findBy
annotation to find the element this process is known as basic initialisation and early
initialisation
Ex-@findBy(Id=”Username”)
Private webelment un;------OR----
Un=driver.findElement(By.Id(“Username”));
-To perform the action on component we need to call method
Before performing each action initElement will identify the component present
Advantages of Page factory-
Code reusability , Accuracy ,easy to maintained .

Q4) Which build automation tool you have used in your project?

Ans We used the Maven build automation tool ver-3.6.3 by apache developer foundation

-We used in our Java project maven tool or maven framework also it is used to manage the
dependencies

-Maven project provides POM.xml file which is core of any project this is configuration file where
all required information are kept , it contain overview ,dependencies ,manage
dependencies ,effective pom.xml.
-As a maven project management tool , we can import all libraries & create project structure ,also it
contain inbuild template called as architype .

-Maven tool is used to compile our application or build.

-It helps to develops & managing the project structure or application like a
deployment ,clean ,packaging , jar & many more features for the java based project.

-In maven , artifact is a file (means jar file) that get deployed to a maven repository .each artifact has
a group id(company name) and artifact id(application or build name & version)

You might also like