Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [page-objects]

Page Object is a design pattern used when creating browser automation.

28
votes
9answers
11k views

Page Objects design issues

I have started using the Selenium 2 /Webdriver web automation framework a couple of weeks ago and I'm generally pleased, but I find myself unsure about how to best design my Page Objects. The ...
19
votes
4answers
53k views

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

I am a beginner in learning selenium Webdriver. I am not able to understand how page object and factory models works and how it can be beneficial? Kindly help me explain it with detailed ...
18
votes
4answers
4k views

Screen Play vs Page Object pattern

I've recently stumbled upon Senenity/JS framework which advocates the Screen Play pattern, which was proposed as a better alternative to Page Objects. What are the key fundamental differences between ...
15
votes
5answers
6k views

What are the trade-offs of using page objects instead of a collection of functions in UI automation?

I've been using Selenium off and on for the past two years. Recently I've been seeing more references to page objects. (I'm referring to page objects as an means of organizing UI automation code -- ...
13
votes
1answer
4k views

Is Selenium's LoadableComponent a good solution as test design pattern?

I need to refactor my Selenium tests, and come across their LoadableComponent wiki page. I began trying to use it, though I couldn't really understand what is it good for. I took a look at their ...
10
votes
4answers
271 views

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

Background: In the Selenium UI automation we all have been using Page Objects pattern as the "Best Practice" for years. In Page Objects "methods" are tightly coupled to pages instead of generic ...
10
votes
1answer
387 views

Does the Page Objects pattern scale?

This question asks if the Page Objects pattern for automated GUI testing works for bigger projects. But as the question was focused on a single testing tool/framework I think its a good idea for a bit ...
8
votes
1answer
12k views

How to use Selenium's PageFactory annotations with dynamic loaded elements?

I'm rewriting some Selenium tests according to the page object design pattern taking advantage of Seleniums' annotations. My problem is that I have some html select elements whose option elements are ...
8
votes
1answer
2k views

PageFactory and nested page objects

In some languages, like Javascript, you can create a hierarchial structure of Elements within a PageObject, like so: class HomePage { loginBox = { usernameTextBox = findElement(By....
7
votes
2answers
4k views

How do I split my PageObject Model classes?

My page object model class is getting rather long. Should I create a different class with the same name as the page object model with a 2 added at the end. Or does this go against the page object ...
7
votes
3answers
628 views

Is page object a framework or design pattern?

Currently I'm using page object design pattern with testing.
7
votes
3answers
529 views

What is page object modelling? and Why is it so important?

I have been hearing a lot about page object modelling? Why is it so important? Can someone please outline me page object model? I'm currently working as QE in webservices area
7
votes
2answers
2k views

Extending or passing the driver in page objects?

I have 2 different ways of working with the driver in the page object model: Creating the driver in all the pages and passing it from one class to another. You have an example here. Extending the ...
6
votes
1answer
2k views

POM vs PageFactory

I'm starting my career as a QA Automation Engineer coming from a Jr dev background. I noticed that there are two main design patterns for Selenium, POM and PageFactory. Which is the preferred design ...
6
votes
3answers
3k views

Use Page Object vs other models for Automation in Selenium Webdriver? [duplicate]

I have been doing automation testing since last 2 years and I am following below ways for any website and mobile application automation testing. Create Global Method class where I implement all test ...
6
votes
1answer
273 views

Structure of page object-based test projects

Are there techniques and/or best practices to create and manage the structure of page object-based test projects? I'm not concerned about the implementation of the page objects, but rather how to ...
6
votes
2answers
941 views

Include assertions/expectations within the Page Objects, yes or no?

Martin Fowler favors having no assertions in page objects however is not definitive on the subject: Advocates of including assertions in page objects say that this helps avoid duplication of ...
6
votes
1answer
5k views

How should I organize a TestNG suite for Selenium 2 WebDriver tests that use page objects?

I'm trying to organize a functional test suite for the UI in a CRUD web application using TestNG-style Selenium 2/WebDriver tests. I've isolated page-interaction logic into distinct page objects, and ...
6
votes
1answer
169 views

How would you convince someone that the Page Object Model pattern is important?

I'm looking for canonical answers explaining the importance and advantages of the Page Object Model design pattern, specifically answers that I could point to for people who claim the pattern is ...
6
votes
1answer
1k views

PageObjects: Aggregation/Composition vs Inheritance for nested components

I need to refactor my Selenium tests, and was wondering what the best design solution would be for a portal with a hierarchical page organization. We are using tiles, and we have defined a baselayout ...
5
votes
4answers
4k views

What framework is Page Object Model

What framework is Page Object Model? I would argue that it is data-driven, since, even though many actions are wrapped in user created methods, it is not totally reliant on keywords. Thus it is not ...
5
votes
3answers
703 views

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

I have a web application which has around 500 pages. Can we use POM framework and if so, is it a good practice? if not, please suggest some ideas.
5
votes
4answers
1k views

How to choose page object design & structure

We had a discussion between several automation engineers on page object design, specifically about how many layers it should have and what are the responsibilities of the layers. I hope you guys could ...
5
votes
2answers
1k views

How to reduce the repetition of code?

I am using page object pattern with java language.First step is driver initialization then go to login page.These steps are repeatable in every test pages. Here is my code.. util package util; ...
5
votes
1answer
186 views

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

Background: As automation testers in selenium world, we have to work on multiple languages/frameworks(wrappers over selenium) in different projects however there is an one thing which remains common ...
5
votes
1answer
99 views

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

I'm automating(using record) a functional scenario using TestComplete. The NameMapping future is automatically adding elements to repository and when I run the script in other browser the tool is ...
5
votes
3answers
251 views

Page Object Model confusion with Automation?

So i've been researching the Page Object Model when composing an automation framework. Most examples are done in Java, but since im using Capybara with Selenium Webdriver (Ruby) for Rails, I imagine ...
5
votes
1answer
163 views

Page object Model discussion

I am building a test framework for my Website using Selenium, I actually want your ideas of good practices when using Page Object Model: let us say that I have a Welcome page that contains a header ...
4
votes
3answers
270 views

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

I just want to ask ideas from you on which is more appropriate to use. I'm currently automating a project using Selenium Webdriver adapting the Page Object Model approach. In the midst of my testing, ...
4
votes
5answers
940 views

POM Framework Design with Global Elements

New to C#, started learning in order to do test automation using Selenium C# with MS Visual Studio. Currently a manual tester. I've been building a testing framework using TDD and the POM pattern. I'...
4
votes
4answers
636 views

Does page factory pattern improve Selenium test performance

Is there any major performance difference between the traditional way of finding web elements vs using the page factory pattern? public WebElement username=driver.findElement(username).sendKeys(...
4
votes
2answers
1k views

How do I make my test code DRY?

My test code has a lot of repetition. First I login to my page then go to the client registration page. Here you can see the repeated code for login. For each page I write first login then current ...
4
votes
2answers
221 views

Page Object Model in Selenium [duplicate]

I never had to test an application with Page Object Model, so trying to study up on that. Questions: Is it true that it is only used when you need to enter different sets of data into the same edit ...
4
votes
1answer
110 views

Actions to search item and number of methods

I have questions about clean code. I'm writing a test in Java selenium page factory. I'm a beginner. I have two "actions", input text into search field and click button search. Now the question is, ...
4
votes
2answers
2k views

How do I structure my Python project based on the Page Object Model

I'm currently trying to implement a base for my automated tests based on the page object pattern with Python, Selenium and Behave. I've never really worked in a reasonably big QA project, especially ...
4
votes
2answers
936 views

Is it a good idea to use Page Object Model with TestComplete?

We're using TestComplete at this company, and we're intertwining a bit of scripting in our Keyword tests. I'm thinking about just turning it into just Page Object Model type tests since the recording ...
4
votes
3answers
3k views

How to implement Page Objects Pattern for an utter dynamic page

Can any one throw some ideas for the best approach for implementation of page object in the below case? - The more the ideas the better - please do write what ever you think small or big dosent matter....
4
votes
2answers
64 views

How you decide the right level of function abstraction in Page object model?

I wonder how people take a call in deciding the right level of function abstraction in Page objects, I sometimes find myself either on a very high level like "CreateOrder" or sometimes very low level ...
3
votes
3answers
157 views

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

I have a login page in my application which I am trying to automate. Should that be automated with a POM class which has a different function for each action, like this: public class LearningPOM { ...
3
votes
3answers
2k views

Test data couldn't able to read from properties file

I got an error in my selenium program. I am using page object design pattern. And I want reading test data from properties file. But it couldn't able to read ? Any one please help me to solve page ...
3
votes
1answer
11k views

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

What I think is that this involves the lazy loading mechanism, where the loading of the page factory WebElements are deferred till it's required. Now if this is the cases then what's the need of ...
3
votes
4answers
4k views

Test strategy for sorting

What will be a good test strategy to test sorting? I have a scenario where when clicking on a sort, i.e. sort the make/model from Z to A, then the listing should be sorted alphabetically from Z to A....
3
votes
2answers
135 views

What high level operations should be tested on a page from Automation perspective?

I'm interested in defining a minimum set of high-level operations which should be validated over a page using the Page Object Model in Selenium Automation Framework. So far I know about the following:...
3
votes
2answers
81 views

Where to define the selector for the navigation step - PageObject vs. Test Class?

I am using Selenium webdriver using the Page Object Model. My question is, where would it be best practice to define the navigation step selector? Should it be in the page object class or in each of ...
3
votes
2answers
74 views

Using different sets of page objects with the same selenium tests

[This is cross-posted from StackOverflow - https://stackoverflow.com/questions/51702719/using-different-sets-of-page-objects-with-the-same-selenium-tests] I'm working on a selenium test suite for a ...
3
votes
1answer
3k views

Timing Page Load in Selenium

I am working with Selenium C# .NET. What I want to accomplish is elegant, extendable page load time logging within my page object architecture. Most new pages are loaded as the result of some action, ...
3
votes
1answer
14k views

How do I extract the inner element in Selenium?

I am new to Selenium and C#, which we are using right now. I am also new to using the Page Object model, to make our codes readable. Though I am having troubles using the FindsBy, so my original code ...
3
votes
5answers
726 views

Webdriver - Page Object Validator

For a while I wrote test for our web application using the Page Object framework. But test after test, I notice, I always wrote the same kind of assert. MyPage page = navigateToMyPage(); page....
3
votes
3answers
2k views

Page Factory @FindBy

I am currently learning page object model (POM) and I am trying to access a specific web element using @FindBy but I am not sure how to correctly write the syntax for my element into @FindBy? What I ...
2
votes
7answers
2k views

Website with complex functionalities?

I'm tired of test automation because I don't feel challenged anymore. 99% of all automation I work with is straight forward, with click and type and no heavy logic. Any tips on websites with very ...