Page Object Model and Page Factory

273 views
Skip to first unread message

Selenium Learner

unread,
Sep 19, 2014, 5:22:45 AM9/19/14
to selenium-users
Hi All,
 
I want to implement a framework. I am trying understand POM concept and Page factory as well, But it looks like same each other. But I read many places as both or different. Please any one can tell me (explain). What is key differences between POM and Page Factory concept. Which is the feasible solution
 
 
 
Thanks in Advance..
 
Regards,
Sunny

Krishnan Mahadevan

unread,
Sep 19, 2014, 5:46:21 AM9/19/14
to Selenium Users
Did you read through the below links ?



In a nutshell PageObjects is a design pattern using which you can build your automation and PageFactory is utility class that works with PageObjects.



Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/
My Technical Scribbings @ http://rationaleemotions.wordpress.com/

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To post to this group, send email to seleniu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/CAGYyqNBaxJVsYZyL7M372vStsvaSbpvXXssqBx-sovUH-yhnkQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

sunny sachdeva

unread,
Sep 21, 2014, 11:55:54 PM9/21/14
to seleniu...@googlegroups.com
Krishnan,

one question. Do you think whether using Page Object can make framework generic. my mind is always thinking about between a generic excel driven framework where user would come and enter low level keywords [like click , sendkeys ] or to create more application oriented page objects.

Lets imagine I need to automate 100 different applications . now if i go to POM based approach, then for for each 100 application i would need to code it from scratch.

Please share your thoughts on this.

Thanks
Sunny

Krishnan Mahadevan

unread,
Sep 22, 2014, 1:43:38 AM9/22/14
to Selenium Users
One of the things that came out of a session that happened during the recently concluded Selenium Conference held in Bangalore was the need to abstract out Page Objects as dummy objects and have business entities sit between a test and the actual page on a browser.

This would ensure that Page Objects are generic enough such that they only provide you means to interact with an actual web page and the Business entities serve as a means for the test to accomplish its intent.

Personally to me this makes a lot of sense, because amongst the same set of 500 page objects (For e.g.,) its only the business entities (That represent various different work flows) which would keep changing in order to satisfy the needs of a test's intent (What the test is trying to test out).

So if you adopt this model wherein the page Objects merely serve as dummy objects, then they can be really generic.

This is one of the things that we managed to do in a different way when we built Selion (http://selion.io). Hope that answers out your question.



Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/
My Technical Scribbings @ http://rationaleemotions.wordpress.com/

sunny sachdeva

unread,
Sep 22, 2014, 4:03:22 AM9/22/14
to seleniu...@googlegroups.com
Thanks Krishnan for your reply. As always you are very kind enough to reply.

Unfortunately I could attend the event and  due to certain network restriction at my office I can connect to GIT so i cant download Selion.

Sorry for asking for more but if feasible  can you show me the dummy code may be taking google or any other site as an example

Thanks
Sunny

David

unread,
Sep 22, 2014, 3:08:28 PM9/22/14
to seleniu...@googlegroups.com
Krishnan,

Are there specific conference talk presentations regarding this topic you mention on page obj as dummy obj and having business entities in between. Hopefully these talk(s) are recorded and on Youtube or so? I had similar ideas in mind to this and would like to see what was discussed/presented.

David

David

unread,
Sep 22, 2014, 3:14:25 PM9/22/14
to seleniu...@googlegroups.com
sunny,

For something that gives you the option of POM as well as Excel/keyword driven framework, that already exists, you can look into Robot Framework (RF), with Selenium2Library - the Java or Python version). RF doesn't use Excel as the input file format but it similar enough and takes tab separated files (TSVs).

Here's an example that showcases implementing POM in RF, the old fashioned "code-based" way you implement POM (as opposed to how others might do it in RF), and the implementation itself calls (lower level) keywords from Selenium2Library that RF uses:


The implementation uses HTML input/test files over TSV and other file formats as I like the visual table presentation that HTML offers.

David

sunny sachdeva

unread,
Sep 23, 2014, 12:23:02 AM9/23/14
to seleniu...@googlegroups.com
Thanks David...

I am big fan  and you can say biased towards TestNG . However I am unable to convince my manager to go for TestNG way [ and not excel driven which is more applicable to QTP] . we have lot of applications to automate and the way my manager looks POM [with factory] using TestnG as a code which is not generic but very much application dependent.

Might be I am OFF the topic but I am still searching for solution where I can use POM design pattern with TestNG to make framework generic.

Of course I will take look about Robot Framework and analyse how can we use this

Thanks
Sunny

Krishnan Mahadevan

unread,
Sep 25, 2014, 2:18:10 AM9/25/14
to Selenium Users
David,
My apologies for the delay in responding back.


Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/
My Technical Scribbings @ http://rationaleemotions.wordpress.com/

sunny sachdeva

unread,
Sep 25, 2014, 3:31:10 AM9/25/14
to seleniu...@googlegroups.com
KM,
I need your help to see if I understood this concept 

 for ex GMAIL Sign InPage, then Page object would have methods like enterUN, enterPW, clickSubmit

and then have another layer which would act as Business Layer and would contain methods like login()

Regards
Sunny

Krishnan Mahadevan

unread,
Sep 25, 2014, 4:20:54 AM9/25/14
to Selenium Users
Sunny,

Yep, you are pretty much on track with what the talk that I shared focusses on.

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/
My Technical Scribbings @ http://rationaleemotions.wordpress.com/

Reply all
Reply to author
Forward
0 new messages