14 votes
Accepted

How to Implement Page Object and Page Factory Pattern in Selenium Webdriver?

PageObjects The code of automated test cases should be easy to understand and not too complex. If a test fails, we want to know why and this as soon as possible. To allow this exists PageObjects. ...
user avatar
  • 1,644
10 votes
Accepted

How do I split my PageObject Model classes?

No. Do not just split your pageObject into pageObject2, 3, 4, etc. This goes for all programming - split your classes logically by function, not arbitrarily! Your page object should be the source of ...
user avatar
10 votes

Screen Play vs Page Object pattern

The key difference is that the screenplay pattern organizes the Page Objects The Screen Play pattern tries to address the issues, challenges and solutions that you will eventually encounter and ...
user avatar
9 votes

What framework is Page Object Model

The PageObject Model is not a framework. A framework is: a basic structure underlying a system The Page Object Model is: an object repository design pattern here. Using the POM might result in ...
user avatar
8 votes

Is page object a framework or design pattern?

Page object is an design pattern. First you should understand the difference between framework and design pattern. For that refer this link. To understand page object design pattern refer this link....
user avatar
8 votes

How to design automation framework when the app to be tested has 500 web pages?

Well, first I would ask these questions: Do you really need to write Selenium test for all of these 500 pages? Do your developers write enough and good Unit tests? I assume it is a Single Page ...
user avatar
8 votes
Accepted

Selenium PageFactory vs Page Object Model

Page Object and Selenium's PageFactory are distinct things in nature, usually the latter complement the former. Page Object is a design pattern aimed at solving the problem of separating the ...
user avatar
  • 9,949
7 votes

How to Implement Page Object and Page Factory Pattern in Selenium Webdriver?

Page Factory Pattern is like an extension to Page Object Model , but Page Factory is much enhanced model. To start with, we just need to import package org.openqa.selenium.support.PageFactory "...
user avatar
  • 6,749
7 votes

Best approach for Page Object Model Framework where the page structure changes very frequently

My first advice is to not write automated tests for pages that change frequently. You may be better off testing those pages manually. If you insist on automation, think about which aspects of the ...
user avatar
  • 23k
7 votes
Accepted

Screen Play vs Page Object pattern

At the UK Selenium Conference, there was a presentation on the Screen Play pattern, see The Screenplay Pattern - a SOLID alternative to Page Objects | Antony Marcano We have a huge technology ...
user avatar
  • 215
7 votes
Accepted

POM vs PageFactory

I think the Page Factory is an extension of the Page Object Model. This Selenium documentation page describes with examples what the Factory adds. If you use the PageFactory, you can assume that ...
user avatar
7 votes
Accepted

In Page Object pattern, aren't we creating over-specialized methods than generalized re-usable functions?

Isn't that what pageObjects are in essence: A description of the UI elements on a Page and how you can interact with them. Now when writing tests you often interact with multiple elements in a ...
user avatar
6 votes

Does the Page Objects pattern scale?

In my opinion, yes, it does. However there isn't really a single way to implement this model that just works. You have to really think about the structure of your website in terms of it's pages, and ...
user avatar
  • 884
6 votes

What is the most standard way to use POM in Selenium?

If you think about what a method actually is (a procedure specific to that class to achieve a certain result or get a value) then I would use a single Login method. Having a one-on-one relation ...
user avatar
  • 5,834
6 votes
Accepted

What does PageFactory.initElements(driver, this) do?

Answering your second question: No, you can't use the same WebElement. You will get a stale element reference exception because the button on the screen is a different button according to the code. ...
user avatar
  • 30.8k
6 votes
Accepted

PoM Design/Architecture questions

To answer your questions: You are correct in that Page Objects are classes and inheriting from a base/parent class is good. When it comes to selectors, the most common option is to have them be ...
user avatar
  • 1,563
6 votes

Page Object Model how much abstraction?

I wouldn't say the PoM pattern is intended to model a behavior. Rather a user interface. Tests are intended to model behavior. If you have your object less abstract then you can assert the results ...
user avatar
  • 11.4k
6 votes
Accepted

Is the Page Object Pattern the ideal approach for browser automation for a website with a frontend that has nested frames?

Yes, Page Objects seem the right direction to encapsulate the frame in frames details from the test. Page objects are a classic example of encapsulation - they hide the details of the UI ...
user avatar
6 votes

Is it necessary to have a very complex Automation framework?

I used my fifth-grade math skills to calculate how much money I'll need to buy coffee. Some suggest that I did it because I'm terrified of college calculus. (I'm paraphrasing.) People say silly ...
user avatar
  • 4,079
5 votes

Cucumber not finding @Findby annotations

Did you run PageFactory.initElements? The PageFactory magic won't actually parse the annotations until you do so. I usually put into the constructor a line like: PageFactory.initElements(driver, this)...
user avatar
  • 3,344
5 votes

How do I split my PageObject Model classes?

I think that you should create a page object class for each page of the site. If you have a single page site, you can create page widgets instead of page objects. The page widgets will correspond to ...
user avatar
5 votes

Screen Play vs Page Object pattern

Disclaimer up front: I do not agree with some of what is quoted below. I believe that a decent POM-framework can lead to VERY readable and maintainable tests. Reading this page, the intent becomes ...
user avatar
  • 5,834
5 votes
Accepted

How to choose page object design & structure

It depends. Case 1 Your first case is the classic object-oriented model where the page elements are the object properties, and the functional routines are the object methods. As long as you keep ...
user avatar
  • 30.8k
5 votes

Canonical way to define page objects/locators in big enterprise level automation projects?

It will depend on your circumstances. Generally I consider categories such as: common identifiers used throughout the application. Examples may include login, logout, help, submit button, etc. ...
user avatar
5 votes
Accepted

Structure of page object-based test projects

I used pretty much the same structure, however it was still a bit different. Since Page Object pattern is more about "page objects" rather than the pages as they are known by the most of the web users,...
user avatar
  • 11.4k
5 votes
Accepted

Flaws in the Page Object Model?

I think if you stick to simple PageObjects as described by Martin Fowler it is fine. It should be a simple abstraction to keep your test-code DRY, reusable and increase readability by using page-...
user avatar
5 votes

How to use Page Objects in this scenario?

When I think how to design a test framework I always ask myself if the code I am writing would be easy to understand by someone else in 6 months. That is why I would suggest to keep it as simple as ...
user avatar
  • 1,037
5 votes
Accepted

How to design automation framework when the app to be tested has 500 web pages?

THINK BIG; We are going to automate everything! I am so excited! act small; Automate a single user flow. (Not login, but a real end-to-end behaviour, login might be part of this.) Fail fast; Struggle.....
user avatar
5 votes
Accepted

Page Object Model how much abstraction?

As with any piece of software, you can consider a few heuristics when deciding abstractions: 1 - On a higher-level abstraction, Single Responsibility Principle: A component (method, class, module) ...
user avatar
  • 9,949
5 votes

Is the Page Object Pattern the ideal approach for browser automation for a website with a frontend that has nested frames?

The first rule of test automation is that there are no hard rules but just recommendations, so don't take the page object model "literally". The concept of page object was there long before the pages ...
user avatar
  • 10.8k

Only top scored, non community-wiki answers of a minimum length are eligible