Page Object in selenium is a robust framework which offers service based approach in Automation.
There are services associated with every page which are nothing but Objects.
Case Study : -
I'll demonstrate page object model for a simple login page as shown below : -

This page can be transformed into an page model approach as shown below : -
Well,Here i have just made a list and separated few of the outstanding similar items in between UI items and its properties(Services).
Few things to notice is when there is a successful login,Home Page loads and when there is a Login Failure, user is on the same page.
Next improved/transformed view can be found below : -

Now as shown above the declaration changed in accordance to our original model.
Role Of Page Factory Class:
Page Factory class used to model the UI elements in a page object model Similar to this : -
Also it replaces the class instantiation by introducing initElements.

--------------------0-------------------------------0------------------------------------0---------------------
There are services associated with every page which are nothing but Objects.
Case Study : -
I'll demonstrate page object model for a simple login page as shown below : -
This page can be transformed into an page model approach as shown below : -
Well,Here i have just made a list and separated few of the outstanding similar items in between UI items and its properties(Services).
Few things to notice is when there is a successful login,Home Page loads and when there is a Login Failure, user is on the same page.
Next improved/transformed view can be found below : -
Now as shown above the declaration changed in accordance to our original model.
Role Of Page Factory Class:
Page Factory class used to model the UI elements in a page object model Similar to this : -
@FindBy(how = How.NAME, using = "username") private WebElement username;
Also it replaces the class instantiation by introducing initElements.
--------------------0-------------------------------0------------------------------------0---------------------
No comments:
Post a Comment