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

Testcafe introduce entry point for tests after authorization

I have a test suite(fixture) with multiple functional tests for test cafe. They look something like this: fixture('Test suite') .page(login_url) .beforeEach(async (t) => { await t.maximizeWindow() await page.signIn('username', 'pass'); …
3
votes
1 answer

Nightwatch.js: Error while running .locateMultipleElements() protocol action: invalid selector: An invalid or illegal selector was specified

I'm using Page Object in Nightwatch.js. I want to simulate login behavior, so the commands in page object module is: commands: [{ setValueToHere(selector,value) { return this .setValue(selector,value) }, …
Oanh Đỗ
  • 31
  • 1
  • 3
3
votes
1 answer

NUnit Running test categories in parallel

I have tests in different classes (Page Object pattern), that may interfere with each other when run together in parallel (they are *not* unit tests). For example, there are classes: AddCustomerFormTests and EditCustomerFormTests, that test adding…
Nawia
  • 41
  • 3
3
votes
2 answers

How to handle dynamic elements in Page Object Model in Selenium?

Is it possible to handle dynamic elements in Page Object Model? Example: package pages; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.support.FindBy; import…
3
votes
4 answers

Handle StaleElementReferenceException while using PageFactory

While using Pagefactory I am directly declaring WebElement as below. @AndroidFindBy(accessibility = "androidLocator") @iOSFindBy(accessibility = "iosLocator") private MobileElement element; But, is there a way out to handle StaleElementReference…
3
votes
2 answers

Nightwatch(PageObject) access elements from different page object

Is there a way to access elements defined in one page object file from another page object file? Example: If we need to access '@usernameInput' from LoginPage.ts file, do we need to duplicate it from HomePage.ts ? Is there any other…
3
votes
4 answers

Is there any alternative for PageFactory using net core

I'm using Selenium v3.6.0 and .NET Core 2.0, the following code gives me an error on PageFactory.InitElements saying it doesn't exist in the currenct context. using OpenQA.Selenium; using OpenQA.Selenium.Support.PageObjects; namespace Example { …
Marcel
  • 1,443
  • 2
  • 14
  • 24
3
votes
1 answer

protractor typescript pageobject property undefined

Hi I'm getting the following error when I use POM in protractor typescript with angular cli "Cannot read property 'sendUsername' of undefined". I'm new to typescript, please suggest me how to resolve this issue. error Failed: Cannot read property…
3
votes
3 answers

Selenium C# Check if IWebElement exists using PageObject

Objective: Check if an element/IWebElement exists on the current page using PageObjects. I am aware of the fact that you can use something like: IWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(3)); IWebElement element =…
Simon
  • 61
  • 1
  • 5
3
votes
3 answers

Selenium/PageFactory: Find child elements using parent element's @FindBy?

I'm trying to convert my selenium tests to use the Page Object Model (and, by extension, @FindBy). I have several object definitions like this: public WebElement objectParent() { return driver.findElement(By.name("parent-id")) ; } public…
kroe761
  • 3,296
  • 9
  • 52
  • 81
3
votes
3 answers

Java selenium Page Object Menu

I'm using a Page Object model. And on my website most page have a menu, so I was thinking I should create a class MenuPage that every other page that have a menu would extends it. But now I would like to regroups all my WebElement from the menu to…
Etienne
  • 165
  • 1
  • 11
3
votes
2 answers

Component objects instead of page objects in selenium

One of the most popular patterns in testing based on selenium is page object. Unfortunately, we often need to duplicate code if we use it as is. Consider the following situation: We use UI framework, with common component, say some fancy…
Konstantin Solomatov
  • 10,252
  • 8
  • 58
  • 88
3
votes
2 answers

Error: Cannot find module ' in Protractor

So I'm new to protractor and trying test using page objects to make the code more manageable. Having some problems with this side of it. Below is my main spec file called 'example_spec.js' describe('angularjs homepage', function() { var home_page…
cmplfore
  • 425
  • 2
  • 4
  • 9
3
votes
1 answer

callbacks/promises for the re-usable methods in Protractor

Should we write callbacks/promises for the re-usable methods in Page Object Pattern based testing in Protractor? For example .. I have the below test code and Page Objects and its working fine without issues. But should I add callbacks for re-usable…
AdityaReddy
  • 3,625
  • 12
  • 25
3
votes
2 answers

Does the Selenium FindBy instantiate WebElement instances in a PageObject class?

Does the Selenium FindBy annotation actually instantiate WebElement instances, and if so, what is the connotation to the framework that uses them? What I have been doing in my page objects looks like this right now. All my test framework methods…
djangofan
  • 28,471
  • 61
  • 196
  • 289