Welcome to the Question and Answer site for Software Testing Professionals

You can get your queries resolved from Software Testing Professionals.

Ask a Question

Get answers and give answers to questions from other members.

View All Questions

Get votes and earn points to build your reputation in community.

View Hot Questions

1
What is difference between POM and Page factory in selenium webdriver Java?

Solved 1 Answers 714 Views
1 1
Hi,

What is the difference between Page object model and Page factory model in selenium webdriver Java?

I want to know each one with detailed examples .Is it possible to use with Selenium C# also?

Kindly reply me.

1 Answer

0
Best answer
0

In POM (Page Object Model) you create new class for every new page/URL and put all your element identification methods in it.

Eg.

If you navigate to my Github - OrangeHRM automation sample project, you will notice that I have two .java files there. Dashboard and Login. So whatever element I identify on Login page, I put in Login.java and whatever elements I identify on Dashboard, I put it in Dashboard.java. This is really helpful in terms of maintenance and usability. So, if I want to work with any element present on Dashboard, I just have to say Dashboard.element. If case of change of element, I just have to change it at one place.

Page Factory is annotation inside selenium which you give it to class. So, when you define any class as page factory, all your elements inside the class will get loaded while any of element in the class is called. This is really a bad practice if you have 100s elements inside a class and you just have to make use of only one.

So, I would suggest you to go with POM. I do not have C# example, but I have similar one in Java which I have already shared.

Feel free to comment back if you need more details.

answered by (192 points)
selected by

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please log in or register.

We have resolved 1.2k+ Software Testing queries!

Software Testing Board Weekly update

We will send you handpicked questions that you would love to answer.

View previous campaigns.

Top Contributors

...