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 ...
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 ...
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 ...
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....
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 ...
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 ...
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 ...
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
"...
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 ...
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. ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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.
...
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,...
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-...
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 ...
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.....
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) ...
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 ...
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 ...
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 ...
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 ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
page-objects × 182selenium-webdriver × 159
automated-testing × 66
java × 49
page-factory × 21
test-automation-framework × 20
c# × 14
browser-automation × 11
selenium2 × 10
test-design × 10
testng × 8
javascript × 8
xpath × 7
cucumber × 7
ruby × 5
pom × 5
python × 4
protractor × 4
selenium3 × 4
test-strategy × 3
exception × 3
testcomplete × 3
test-architecture × 3
selenium-webdriver-c# × 2
excel × 2