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
1
vote
2 answers

PageObject with Ruby - set text in a text field only works in the main file

I'm automating a site that has a page with a list of options selected by a radio button. When selecting one of the radios, a text field and a select list are presented. I created a file (test_contracting.rb) that is the one through which I execute…
1
vote
1 answer

JavaScript class vs function returning object

So im pretty much used to always using classes when writing automation code (Using the Page object Model). However i've came across some PoM/Component sample code that im not really used to seeing. For example this header.ts file is not what I am…
msmith1114
  • 2,717
  • 3
  • 33
  • 84
1
vote
1 answer

TypeError: 'str' object is not callable selenium -

Here is a small test carried out with selenium in python: locators = { "entreprise_selection": ("ID", 'uidropdownCompanies'), "entreprise_load": ("XPATH", "//a[@id='company_98']/div/span"), "filter": ("XPATH",…
1
vote
2 answers

Re-Creating Page Objects in Playwright?

In Playwright (Like many other automation frameworks) you can create page objects. Using an example from Playwrights documentation: https://playwright.dev/docs/test-fixtures#without-fixtures You have a .spec file that looks like this (The actual…
msmith1114
  • 2,717
  • 3
  • 33
  • 84
1
vote
2 answers

Cypress.io - How do I wait for the result of a method that returns an invoked attribute?

I have a method that gets the href-attribute of an element hrefAppTheme and checks if its one of the values of the string-array appThemes: describe('...',() => { it('should ...', () => { (...) let defaultAppTheme = ''; …
Jan and RESTless
  • 199
  • 1
  • 14
1
vote
3 answers

Get CSS string value from locator page object in MS Playwright

Lets say I have a class containing page objects. If I instantiate that class in a test, then I can use the page objects as you normally would with playwright. I would like to get the css value as a string from one of those page objects so I can use…
1
vote
1 answer

Function implementation showing type error in Cypress while running tests

I am working on cypress for web application automation and having an issue with accessing a function from an object. The code below is from a javascript file in 'e2e' folder. class productsDemo { pageObjects = { productName:…
rino
  • 293
  • 1
  • 4
  • 13
1
vote
0 answers

In python project(with page object) conftest file doesn't get driver from pages

I try to create the project with page object(python 3.9) and my conftest.py file doesn't receive any driver from its pages. Any page has _init constructors,but in the conftest.py file we can see that no driver is given. I will be glad if you have…
Romanich
  • 29
  • 4
1
vote
2 answers

How to pass PageObject for cucumber step definition

I see the following step in noraUI sources @And("I expect to have {page-element} with the text {string}(\\?)") public void expectText(Page.PageElement pageElement, String textOrKey, List conditions) throws FailureException,…
Dany
  • 21
  • 3
1
vote
1 answer

Cypress return value in class method

I am trying to apply the Page Object Model (POM) to some tests using Cypress. Unfortunaly I can't read some webelement value and return it as a method or function value. I needed to make something like these to work: var1 =…
naguall
  • 43
  • 1
  • 8
1
vote
0 answers

re-use new page object for each test

So I am using playwright/test with Typescript I have a testapp.ts setup which contains all my methods eg for logging in, navigating etc Inside my test example.spec.ts each test looks like this: const testapp = new TestApp(page); await…
1
vote
0 answers

Page objects initialization for Playwright

In my current Playwright test automation project, we use page object model pattern. At the beginning I was initializing all page objects within a test (usually in before hooks) test('something', async ({ page}) => { const loginPage = new…
Coldwine
  • 11
  • 1
1
vote
0 answers

Class methods vs Instances when using Page object model in ruby

I hope you are having a great day! I'm wandering something, when using the POM (Page object model) we always create new instances of our classes, like the following simple example: class LoginPage def initialize(driver) @driver = driver …
1
vote
1 answer

Why list is required just to cancel single pop up in selenium webdriver?

In Page Object factory: By popup=By.xpath("//button[test()='NO THANKS']"); public List getPopUpSize(){ return driver.findElements(popup); } public WebElement getPopUp(){ return driver.findElement(popup); } Calling above methods into…
Jackie M
  • 65
  • 7
1
vote
3 answers

Re-using login functionality in Selenium page object model tests

I am exploring the use of Selenium 2 on a web application which requires authentication before a user can use any of the application. I am planning on either JUnit 4 or TestNG (Still investigating which one to use with Grid 2). I may plan to use…
Ilyas Patel
  • 400
  • 2
  • 11
  • 27