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
2
votes
2 answers

How to pass variable value on Page Object Model

I am creating my project with Page Object Model, To define simple element, it is simplest to define By loginEmailParse = By.id("signIn-email"); and to call it : driver.findElement(loginEmailParse); But, when we have condition with variable,…
user9794273
2
votes
1 answer

How to identify a particular Page Object fragment member element through Selenium

In our project we have multiple selenium tests run with cucumber which are testing specific components. One of these components are two identifiers, which we call country identifier and site identifier. These have the following HTML:
2
votes
1 answer

Where should I define modal specific code in Selenium Page Object Model pattern

In Selenium Page Object model pattern web pages are represented as classes, various elements on the page are defined as variables in the class, and user interactions are implemented as methods in the class. That is for each page separate class is…
ANP
  • 165
  • 12
2
votes
1 answer

Having issues defining Xpath while using Page object in Selenium WebDriver testing

Selenium newbie here... I am trying to create my first test framework . Test Website : https://www.phptravels.net/ Test Case : Open Browser and enter the webpage Once the page is loaded , click on MyAccount ->Login I have used xpath in my…
QQ_TT
  • 35
  • 4
2
votes
0 answers

Selenium and page object model: best practices when dealing with users

I'm using selenium on java to write an automated suite following the page object model. My suite has to perform several actions with a random user, so I randomly create a user name and password, and then I have to use those credentials to perform…
Floella
  • 1,279
  • 1
  • 22
  • 41
2
votes
1 answer

How can you return a new valid page object with WebdriverIO?

We have just started implementing a WebdriverIO-mocha-chai framework at work and since I have a Selenium/Java background, it's a little tricky for me to wrap my head around it. My page objects look like this: **page.js** export default class Page…
2
votes
1 answer

cucumber best practices

One of my clients is interested in using Cucumber. But I still have few questions about that: Should the dev team adapt their code to the Gherkin file? Should we start a project from scratch to follow Cucumber pattern? where should we store our…
2
votes
0 answers

Protractor Page Object Implementations

I recently started working with Protractor and still find it difficult to choose between different ways of doing things. I've seen different style guide that show different way of implementing the Page Object Pattern (objects vs functions). I have…
gxo
  • 21
  • 2
2
votes
1 answer

Framework creating Using Page Object Model Selenium Webdriver Java TestNG and Maven need to access multiple pages on a web page

Using Selenium webdriver I am trying to test a web application and my test is to Login to the web application, Once logged-in, on the left-hand menu panel I need to click on a parent and that will show the child link and when I click the child link…
SKV
  • 133
  • 1
  • 3
  • 14
2
votes
2 answers

How to call test method by creating object in testNG

I'm using POM framework and managed the code in following way : This is My InviteFriendPage public class InviteFriends { @FindBy(xpath ="//li/a[normalize-space()='Invite Friends']") public WebElement inviteFriendsLink; @FindBy(id =…
NarendraR
  • 7,577
  • 10
  • 44
  • 82
2
votes
1 answer

Locator object cannot be null with Selenium PageObjects

I'm sure this is a simple one but I have not been able to find the cause of this error let alone the solution. I am using selenium page objects which has been running perfectly up until now when I have added a new page to my tests. Here is my main…
Smithy7876
  • 316
  • 4
  • 13
2
votes
1 answer

Getting element from pageobject in protractor

Im writing some Protractor testcases by using a pageobject. However im having trouble using elements directly from the Pageobject file, in the spec file. Possibly im missing some JS nuance, since i havent written that much in JS. i would like to use…
2
votes
3 answers

Protractor - Page object: Failed: is not a function

I'm working with Protractor and I create a page object. This is my page object: 'use strict'; var CreateAgent = function () { this.agentEmail = element(by.model('agent.email')); this.janrainConsoleAgent =…
burq24
  • 279
  • 1
  • 5
  • 18
2
votes
1 answer

storing test data for a test framework using the page object model

What are some recommended ways to store data for a java test framework using the page object model? For example, I have a login test scenario with a LoginPage page object and a LoginTest which uses the LoginPage to run tests. I say something like…
2
votes
2 answers

Java Page Object Model Best Practices - New Objects

What is the best approach to instantiating up objects on creating steps in a Java Page Object Model? Does anyone know how Cucumber scripts are compiled? I would imagine if everything is built and complied the 2nd or 3rd option below may be the best…