Skip to main content
Share Your Experience: Take the 2024 Developer Survey
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 ...
Michael Durrant's 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 ...
Niels van Reijmersdal's 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....
Devmati Wadikar's user avatar
8 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 ...
Niels van Reijmersdal's 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 ...
masood ghz's 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 ...
João Farias's user avatar
  • 10.9k
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 "...
Bharat Mane's user avatar
  • 6,775
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 ...
CloneZero's user avatar
  • 215
7 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. ...
Kate Paulk's user avatar
  • 31.5k
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 ...
Niels van Reijmersdal's user avatar
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 ...
FDM's user avatar
  • 5,894
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 ...
Lee Jensen's user avatar
  • 2,231
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 ...
Alexey R.'s user avatar
  • 11.6k
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 ...
Niels van Reijmersdal's user avatar
6 votes
Accepted

Page Object Model from scratch: Best Practices?

As a general principle, I'd follow a relatively simple approach: YAGNI (You ain't gonna need it) - don't code something until you need to automate it. DRY (Don't repeat yourself) - if you find ...
Kate Paulk's user avatar
  • 31.5k
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 ...
Mate Mrše's user avatar
  • 4,119
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 ...
FDM's user avatar
  • 5,894
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 ...
Kate Paulk's user avatar
  • 31.5k
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. ...
Michael Durrant's 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,...
Alexey R.'s user avatar
  • 11.6k
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-...
Niels van Reijmersdal's 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 ...
Moro's user avatar
  • 1,052
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.....
Niels van Reijmersdal's 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) ...
João Farias's user avatar
  • 10.9k
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 ...
PDHide's user avatar
  • 11.1k
4 votes

Page objects - use a separate method for each step or 1 method for all steps?

I would base this on whether the individual components will be used in other tests. If the methods like enter username are only ever used together with the password methods, then make them be 1 ...
Michael Durrant's user avatar
4 votes
Accepted

How to reduce the repetition of code?

You can use a base-class to contain the duplicated code for each test. Read about inhertance and subclasses here: https://docs.oracle.com/javase/tutorial/java/IandI/subclasses.html If you have a ...
Niels van Reijmersdal's user avatar
4 votes

Is page object a framework or design pattern?

According to Selenium official documentation: Page Object is a Design Pattern which has become popular in test automation for enhancing test maintenance and reducing code duplication. It is not a ...
dzieciou's user avatar
  • 10.5k
4 votes
Accepted

Hierarchy and names of objects in mapped name of a same object are varying from browser to browser in TestComplete

Using record-replay automated testing tool has its ups and downs, and the problem you are having is one of those downs you will have to deal with all the time. There is only one way to completely ...
Yu Zhang's user avatar
  • 9,942
4 votes

PageFactory and nested page objects

Inheritance can get messy real quick, one thing you can try instead of using inheritance, is to use composition. Create your nested page objects as full top level classes, then put them into your ...
Julian's user avatar
  • 914

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