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
3
votes
1 answer

Error when using the same browser instance for several features on Cucumber

I have a problem creating browser instances for Cucumber drivers. If i create the object on env.rb inside the “Before do” as: Before do @browser = Watir::Browser.new 'firefox' end …works fine, opening a new browser for each feature and closing it…
3
votes
3 answers

Dynamic page URL

I have a page with URL that is dynamic. Let's call it view post page. URL for post 1 is site.com/post/1 and for post 2 is site.com/post/2. This is what I do at the moment to check if I am at the right page. The page: class ViewPostPage include…
Željko Filipin
  • 56,372
  • 28
  • 94
  • 125
2
votes
2 answers

Cypress JS using multiple page objects in one method

i have been struggling with some logic about using multiple page objects in one method, i couldnt find any idea to use like that logic, for example; These are my methods in my page object called usersTable; get rolesAndStatusMenu() { return…
2
votes
2 answers

Reuse steps of Specflow when using Page Objects pattern

I am using Specflow with page objects and I have a lot of scenarios which are very similar. For example: Given I view the 'page1' When I click 'link1' Then I should be on 'page2' Given I view the 'page1' When I click 'link2' Then I should…
regisbsb
  • 3,664
  • 2
  • 35
  • 41
2
votes
1 answer

Cypress.io page objects cause 'cy.click() failed because it requires a DOM element.' error

New to cypress, but did a couple projects in Protractor and TestCafe. I'm aware of the controversy using PO's in cypress, but due to the complexity / nature of our app, we're going with it. Refactoring the test to remove PO's and include the app…
Anton321
  • 33
  • 1
  • 3
2
votes
1 answer

Using static in page object (Cypress)

Looking through various examples of implementing e2e tests on Cypress, I came across the fact that many people use the method of creating a new object, instead of using static. Why do they do this? Why not use static for page-object methods, because…
theKosh
  • 56
  • 7
2
votes
2 answers

Which methods should be inside a Page class in POM design pattern?

I am creating a UI test automation framework using POM design pattern. After reading SeleniumHQ page for Page Objects, I am contemplating what all methods should I create inside a Page Object. Let's take a simple example of login page object…
brij
  • 331
  • 1
  • 5
  • 17
2
votes
2 answers

Use visibilityOfElementLocated with pagefactory

I'm writing automated scripts using page factory and I want to use visibilityOfElementLocated with page factory instead of visibilityOf I tried to use visibilityOf but some times it not work with my element the problem here that…
2
votes
0 answers

Wdio/TypeScript - Cannot find module when running test in BitBucket-pipelines

I have a project webdriverio/typescript (using Page Object) which is meant to run on BitBucket pipelines. When I run the test locally all works correctly but when I push to Bitbucket the pipeline fails, none of the tests will…
2
votes
1 answer

Returning an object which will only be used sometimes

Python - Page Object Model Does returning a page object which will only be used in 80% of cases violate any best practices? def delete_list_item_by_name(self, item_name): ... code to find the proper list item ... row_del_btn =…
Jeremy S
  • 29
  • 2
2
votes
1 answer

How do you execute javascript element using PageObjects and @FindBy in java selenium

I am creating page objects for navigating through a site and refactoring hashed together Java project. I have a piece of code which invokes a JavaScript button. However, I can't work out how to set this up to be used in page object format with…
Ballard321
  • 33
  • 3
2
votes
1 answer

Page object model is not Working Selenium Python

My Selenium python code for POM is Not Working Properly guys i dunno what Wrong i did down am Pasting My Code Please Sort Me Out. index.py the Location is = MyProject/Testmethods/index.py from selenium import webdriver from…
koushick
  • 497
  • 2
  • 8
  • 30
2
votes
1 answer

Vue CLI 3 Nightwatch page object configuration

I'm using Vue CLI 3 version 3.0.5. In project configuration, I use Nightwatch as e2e test tool. I try to use page objects, so I had nightwatch.config.js file in project root, and add page_objects_path inside like below: { page_objects_path :…
Arel Lin
  • 908
  • 2
  • 13
  • 24
2
votes
1 answer

Creating own Customised MobileElement by extending from MobileElement

I am trying to have own customized MobileElement class that i can add more methods. For example I have a class named SamplePage and it contains below mobile element: @iOSFindBy(accessibility = "Settings") @AndroidFindBy(id = "Settings") public…
Random
  • 31
  • 3
2
votes
1 answer

How to initialize an instance variable (declared in a test fixture in nunit) every time before each test method(contained in the same test fixture)?

I have 3 nunit test cases under the same test fixture in vs2015. When I run the test cases individually, they pass. But when I run them together the 1st test case passes, the others fail. Because I have an instance variable, i,e a c# property in the…
callyaser
  • 155
  • 11