Questions tagged [pageobjects]

A design pattern to represent a web page as an object. Usually used in UI / end-to-end testing and browser automation.

A page object provides access to a web page. In its implementation, a page object typically makes use of a web driver like or . The page object hides the html and web driver details, and provides an abstract interface to the page in terms of its application domain.

The page objects are subsequently used to create end-to-end test scenarios that click through the application. The use of page objects make these tests easier to maintain when details of the underlying pages change.

This tag can be used for questions on the design, implementation, and use of page objects for end-to-end testing of web applications.

More information:

845 questions
4
votes
1 answer

Require a field as part of a Rust trait

Is it possible to require that a struct have a particular field as part of a trait? I am doing some web automation in Rust with the thirtyfour_sync crate. I want to write some traits with default implementations for page objects that will implement…
4
votes
1 answer

Using the Page Object Model is it better practice to return a promise or to use async/await in the function when the function does not return a value

Hoping to get some feedback on what is the best practice in this situation (Protractor testing framework using page object model with async/await instead of SELENIUM_PROMISE_MANAGER). Let say I have a function called setUsername which simply sets…
DublinDev
  • 2,318
  • 2
  • 8
  • 31
4
votes
1 answer

What are the advantages/disadvantages of using the Screenplay pattern over Page objects?

I have watched a video on youtube that suggest using screenplay pattern as an alternative to using the usual pageobjects. The only advantage I see is that the page object classes are not as big. Is there something else I am missing ? I have been…
mosaad
  • 2,276
  • 5
  • 27
  • 49
4
votes
2 answers

Page object pattern with protractor

I am trying to creat to page object files with protractor. My app has the following layout. and page object files.. navbar_po.js var NavBar = function() { // define navbar elements and operations // . // . }; module.exports =…
4
votes
4 answers

Selenium Page Object. How to read @FindBy locator from external source?

I can only use hardcoded values in page object @FindBy annotations But I would like to resolve locators dynamically. public class LoginPage extends BasePage { // hardocded value works ok @FindBy(name = "login field") WebElement…
ludenus
  • 1,161
  • 17
  • 30
4
votes
2 answers

What's the correct Protractor's syntax for Page Objects?

I've come across different types of syntax for Protractor's Page Objects and I was wondering, what's their background and which way is suggested. This is the official PageObject syntax from Protractor's tutorial. I like it the most, because it's…
anks
  • 303
  • 2
  • 12
4
votes
1 answer

PageObjects + non-angular page - how to join them?

I'm writing some protractor tests for our application. There is one place where is non-angular page as iframe in angular page. Problem: I'm unable to map fields from non-angular page in Page Object object and use them in right time in my test…
user2377585
  • 67
  • 1
  • 2
  • 9
4
votes
3 answers

Angular Protractor end-2-end test fails after clicking a button

So today I have been working on setting up end-2-end testing for an Angular JS app with Protractor. For writing cleaner tests, I make use of the Page Object pattern as described on the Protractor website. Test scenario: When a user enters the…
Kaj Nelissen
  • 915
  • 10
  • 29
4
votes
2 answers

Page Objects Design: Is there a Javascript equivalent to Ruby gem "site_prism"

I'd like to know if there is a framework in Javascript (NodeJS) for Protractor which supports a clean way to define the Page Object Elements on a Page Object as site_prism does. I've already checked astrolabe but doesn't quite fit the purpose. This…
Leo Gallucci
  • 16,355
  • 12
  • 77
  • 110
4
votes
4 answers

WebDriver PageFactory Find Elements List

I have multiple elements on a page and I would like to initialize them using PageFactory. I have tried using following @FindBy(xpath = "//*[contains(@class,'x-grid-tree-node-leaf')]") List allElements; but this returns only one…
aeinstein83
  • 289
  • 3
  • 10
  • 22
4
votes
2 answers

Can we handle the browser cookies using Page Object?

Can we able to handle the cookies in a browser at the time of execution? Actually I need to get the cookies from the browser and need to set the modified cookies in between the scenario execution. Can we able to do it using Page Object? I check the…
KAK
  • 905
  • 4
  • 14
  • 33
4
votes
4 answers

Selenium WebDriver Recorder for PageObject pattern

I know there are the Selenium IDE and the Selenium Builder as a Firefox plugin to record actions and export them e.g. as C#-Code. But is there also a tool which helps you with creating Selenium (2) WebDriver Test-Code following the PageObject…
10ff
  • 813
  • 4
  • 16
  • 31
4
votes
1 answer

How to represent Page Object navigation in a Selenium WebDriver project using java

I have read in a few places that Navigating between Pages when using WebDriver API is typically done by the Page Object returning the next page that should be returned when the action that causes the navigation to occur. The solution works great for…
Jamie Piltz
  • 205
  • 1
  • 3
  • 12
3
votes
1 answer

How can I avoid multiple awaits when queueing async methods in typescript/playwright

Currently I am writing a small test project for which I use the Page Object Model and Playwright. I have pages with methods returning either the page itself or another page. This makes it easier for me to write the tests. However, as I am using…
Simon
  • 61
  • 1
  • 5
3
votes
2 answers

Appium POM java.lang.NoSuchMethodException: jdk.proxy2.$Proxy15.proxyClassLookup()

Setting up appium on my new mac. When executed a Test am seeing below error, java.lang.RuntimeException: java.lang.NoSuchMethodException: jdk.proxy2.$Proxy15.proxyClassLookup() at…
KALYAN
  • 31
  • 3