Questions tagged [page-objects]

Page Object is a design pattern used when creating browser automation.

Filter by
Sorted by
Tagged with
5
votes
3answers
461 views

Is the Page Object Pattern the ideal approach for browser automation for a website which has a front-end that has frames in frames?

I'm confronted with a web application which has a front-end that has frames in frames in frames. Regarding automated UI Tests with Selenium and Cucumber, is the Page Object Pattern the right approach ...
1
vote
1answer
24 views

How could I improve my page objects for this iterator assertion?

I am writing a e2e test for my front end web app with webdriver.io and node/javascript. Specifically, I want to improve my page objects. I have a dropdown that has two items(two rows of items) in a ...
0
votes
1answer
50 views

Page Object Model: Handling Large Forms [duplicate]

So i've ran into what is probably a common issue when designing a page object model based framework. For this specific example I am using Cypress (So JavaScript) but the problem exists for all PoM ...
8
votes
6answers
619 views

Page Object Model how much abstraction? [duplicate]

When developing a page object model, the whole intention is generally to abstract the page into methods that keeps code reusable and increase readability. Something I often get stuck on how high of a ...
3
votes
2answers
69 views

Selenium WebDriver - should explicit waits be held in the test method or within the page object?

As the question title says: If you're putting a test together and you need to wait for an item to be displayed (as an example), is it best to put the explicit wait within the test or against the page? ...
2
votes
2answers
64 views

java.lang.NullPointerException problem in Selenium Test

I'm learning Selenium POM with Junit and ran into a problem. java.lang.NullPointerException at MainPage.clickSignIn(MainPage.java:27) at MainPageTest.signInTest(MainPageTest.java:28) My class: ...
-1
votes
2answers
43 views

Using existing framework for new PoM framework bad practice? [duplicate]

So I am implementing my own Page Object Model framework for a web application. It's my first time writing my own framework but I think I for the most part understand how I need to write it. The ...
0
votes
0answers
86 views

Why doesn't 'this.driver = driver', do the same as 'PageFactory.initElements(driver,this)'?

I have a page object with im trying to instantiate so that I can perform methods on it in my tests like goto etc. But when I try to use it with PageFactory.initElements(driver,this);. The browser ...
5
votes
1answer
103 views

PoM Design/Architecture questions

Apologies if this is an improper question, as it's actually a multi-part question (But it seems like unnecessary clogging of the site to make multiple posts). Im writing my first PoM framework, it's ...
4
votes
1answer
321 views

Selenium PageFactory vs Page Object Model

I've created a framework in C# using the Page Object Model for fun and am now creating a framework in Java to learn Jenkins etc... also for fun. I have come across the PageFactory concept for Java ...
1
vote
1answer
45 views

Protractor right approach to page object model

On Investigating on protractor page object model, i came across the below two approaches: First: var AngularHomepage = function() { var nameInput = element(by.model('yourName')); var greeting =...
0
votes
1answer
39 views

Advice or articles about unit testing page objects and related UI test infrastructure code

Does anyone write unit tests for page objects and related UI test infrastructure? If so, what suggestions do you have for designing those unit tests? Do you mock WebDriver instances, or take another ...
2
votes
1answer
83 views

Representing Complex Objects for Page Object Model?

So this is sort of a follow up question to me previous question: Page Object Model: How much abstraction is necessary? In an effort to make my test scripts simpler and methods easier (since ...
6
votes
2answers
219 views

Page Object Model: How much abstraction is necessary?

So i've been working on a Page Object Model framework for a large web application for our current company. It's the first time i've made my own framework and implemented the page object model. Im ...
2
votes
2answers
39 views

To use direct page URL or complete path?

My question is which approach is recommended when writing automation test for testing something like filters present on page no.3? Should I directly use url of page no.3 in my test file and test ...
0
votes
1answer
87 views

POM + PF on project with web and responsive mobile web

I am using Selenium POM (page object model) with PF (page factory) for various desktop web browser tests. I just started quest - testing responsive mobile web on real mobile devices. I already have ...
0
votes
1answer
376 views

Selenium WebDriver “Cannot instantiate class ” error is coming

Below is my Base Class: package com.mercury.qa.base; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.util.Properties; import java.util....
5
votes
3answers
757 views

How to design automation framework when the app to be tested has 500 web pages?

I have a web application which has around 500 pages. Can we use POM framework and if so, is it a good practice? if not, please suggest some ideas.
3
votes
3answers
240 views

How to use Page Objects in this scenario?

I have a website with a home page that requires a user to be authorized or logged in to see all pages of the website. If you try to access the home page, but you are not logged in, then the website ...
2
votes
4answers
2k views

Replacement of @Findby in pagefactory for dynamic value with locator

I like to use POM pattern with page factory and in fact I have been using it since long in my various automation frameworks. Some time I am facing issue where I have to write text based xpaths in ...
0
votes
1answer
222 views

Getting 'java.lang.NullPointerException' on executing test Cases

import org.openqa.selenium.WebDriver; import org.testng.Assert; import org.testng.annotations.AfterMethod; import org.testng.annotations.BeforeMethod; import org.testng.annotations....
0
votes
1answer
66 views

How can I test if a page object yml file has orphaned keys using rspec?

I like using page objects through a yaml file with name:locator pairs One problem I run into is that over time as the locators file grows, test cases are changed or removed and we end up with ...
1
vote
3answers
355 views

Flaws in the Page Object Model?

I read this article about flaws in the Page Object Model/POM, authored by a lady at ThoughtWorks - https://blog.getgauge.io/are-page-objects-anti-pattern-21b6e337880f She says that POM leads to ...
2
votes
1answer
70 views

Selenium page object work - does it find all elements at one go in same class?

I am wondering if page object is really fast. Lets say I define 10 or 20 elements in a page object class. I don't use it regularly. At any given time, I use only 2 3 elements or actions, all elements ...
2
votes
2answers
243 views

Page Object Model and Automated Frameworks with Ruby?

So i've been reading a lot on Page Object Model. Im going to be starting developing a framework for a new project. We are using Selenium Webdriver w/Capybara (Ruby). I've seen most examples of PoM in ...
2
votes
1answer
5k views

PageFactory is deprecated in C# (.NET) - what to use instead of that

I was using for a long time PageFactory (in Java). Now writing tests in .NET I found out it's deprecated. Right now I just initialize all page objects when application starts using [BeforeScenario] ...
4
votes
4answers
290 views

How to deal with huge PageObject using POM in Selenium?

I've got a question about dealing with huge PageObject. In the website that I'm currently testing there is a form with circa 50 inputs/dropdowns/selects. In the current state my class got about 900 ...
2
votes
1answer
390 views

What is the good practice to instantiate page object in POM and PageObjectFactory?

I am practicing POM and Page Object factory. I would like to learn good practices in instantiating the pages. till now I am Instantiating the pages from test class (e.g. TC_01_Register.java) using ...
1
vote
1answer
649 views

How to parameterize @findBy in pageFactory

I am trying to implement a page class for footer in OpenCart application. which is having multiple links with same or similar properties except link text. What is the best way so that we can define ...
6
votes
1answer
188 views

How would you convince someone that the Page Object Model pattern is important?

I'm looking for canonical answers explaining the importance and advantages of the Page Object Model design pattern, specifically answers that I could point to for people who claim the pattern is ...
2
votes
1answer
96 views

Scrape items from an HTML list

When Catalog receives a fragment for a book category, it seems to my eyes, to be just list items. For space, I didn't include that output. How can I ensure that only categories which belong to the ...
1
vote
1answer
394 views

POM: driver is passed as an argument? Always?

Example code: Driver is being passed as an Argument so that Selenium is able to locate the element on the browser (driver). Element is returned, so that an Action can be performed on it. ...
2
votes
0answers
203 views

decompose an HTML list with page fragments

note: Looking for simplest possible example of PageFactory and fragments. I've been referencing an article which uses additional libraries I wasn't aware of. The desired structure: Where there's ...
0
votes
2answers
106 views

While following Page Object Model, how handle Fragments in Android

I was searching over INTERNET, i didn't find solution for this coding puzzle, let say we have listView and each option will return different screens object. Now I need to create a method that on click ...
2
votes
1answer
194 views

Object Oriented Programming with Selenium Page Objects

I'm struggling with how to apply inheritance and composition with Java for scraping sample data. App driver: package dur.bounceme.net.SeleniumBase; import java.io.IOException; import java.util....
1
vote
1answer
280 views

how to Iterate a List of links?

This "Books" link shows that it has the following xpath: /html/body/div/div/div/aside/div[2]/ul/li/a Then follows the catalogue categories: Travel, Mystery, etc. Reading the xpath above I see ...
1
vote
2answers
1k views

NullPointerException when using @FindBy

I'm getting a NullPointerException when trying to use @FindBy because the object reference is only declared and not instantiated. What is the usage? The docs give example declaration but no instance ...
0
votes
1answer
488 views

xpath query for specific String value

My project is crashing with: Element info: {Using=xpath, value=//a[contains(text(), 'Books')]/@href}. The output (crash): thufir@dur:~/NetBeansProjects/com.toscrape.books.selenium$ thufir@dur:~/...
1
vote
1answer
58 views

Same element locators under different parents

This is more of a "code review" question but it is very SQA specific so posting it here. There are two different menus on a page: "left" and "right" both containing "save" and "cancel" buttons with ...
0
votes
4answers
197 views

Selenium PageObject model returns multiple objects

Please find the below code and I'm trying to return 2 objects ( Page6 and Page7 ) but it's asking me to remove the second object. Please let me know how to return multiple objects using return type ...
3
votes
1answer
261 views

Page Object Model: need help with tests that uses more than 1 page object - Appium-Java-TestNG

I have a framework based on POM model. I am able to write test that only uses elements from 1 page but when I need to access elements from another page tests fail because I think it uses the wrong ...
0
votes
2answers
111 views

Selenium - Design considerations for filling out forms

I am using Selenium to develop automated test cases, some of which involve filling out forms with dozens of input fields. At the moment, I am following the Page Object Model/Page Factory design ...
1
vote
1answer
78 views

Which Page Class (POM) to verify successful actions from?

I am working with Selenium WebDriver + Java and following the POM design pattern to create automated tests, one of which involves verifying successful logout of a user account from a webapp. Does it ...
0
votes
2answers
164 views

POM Model -Fetching mobile number from excel sheet like 9.5512395512E9

Working on Page Object Model by using Data driven Framework, fetching data from Excel sheet.When executing the test script the mobile number displays like 9.5512395512E9. In excel sheet Original ...
0
votes
2answers
105 views

How can I keep the variable alive across the project globally?

I have a BaseClass.java which extends PageObject.java class i.e. net.serenitybdd.core.pages.PageObject; Then I have two Page classes LoginPage.java and ProfilePage.java, these two also extending the ...
0
votes
1answer
60 views

How modularized should page class methods be?

When following the POM design pattern, how modularized/specific should the page class methods be? i.e. if I have a test that involves entering a username and password, is it better practice to: ...
2
votes
1answer
83 views

How to iterate i value in page object model

I need a solution how to iterate value of i. Actually my test case contain one webtable and table have five column also fifth column contain four buttons. So depending on the first column value(for ex ...
0
votes
1answer
127 views

Question about handling random “no such element” exception in WebDriver Java

So here's the setup, we have tests where we fetch test data from excel sheet and iterate over all the rows within a particular test. So, for example, there are tests that create some user profiles, ...
1
vote
1answer
745 views

How to use the page object model pattern in C# without deprecated libraries

What can I use as an alternative option to the soon-to-be deprecated OpenQA.Selenium.Support.PageObjects library? I still want to make sure I encapsulate the elements and be able to assemble the ...
0
votes
3answers
1k views

How to resolve 'No such element exception'?

I am getting below error even though I was using correct identifier. No such element exception: Unable to locate element: {"method":"id","selector":"input_001"} HTML Code: <input type="text" ...