Questions tagged [page-objects]

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

Filter by
Sorted by
Tagged with
0
votes
0answers
51 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
74 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
203 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 ...
0
votes
1answer
30 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
31 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
64 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
143 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
69 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
180 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
749 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
233 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
900 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
90 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
37 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
261 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
65 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
178 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 ...
1
vote
1answer
4k 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] ...
3
votes
4answers
175 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 ...
1
vote
1answer
224 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
473 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
178 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
83 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
234 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
161 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
92 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
138 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
197 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
808 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
395 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
55 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
141 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
207 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
96 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
65 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
100 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
101 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
57 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
68 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
112 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
625 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" ...
9
votes
4answers
430 views

In Page Object pattern, aren't we creating over-specialized methods than generalized re-usable functions?

Background: In the Selenium UI automation we all have been using Page Objects pattern as the "Best Practice" for years. In Page Objects "methods" are tightly coupled to pages instead of generic ...
0
votes
2answers
516 views

How to parameterize locator in Selenium

I am new to selenium, And In my scenario I need to select a product for list of products in the page. And Product name to select is a test data. Now my query is,Can I create Object in Class level ( ...
3
votes
2answers
89 views

Using different sets of page objects with the same selenium tests

[This is cross-posted from StackOverflow - https://stackoverflow.com/questions/51702719/using-different-sets-of-page-objects-with-the-same-selenium-tests] I'm working on a selenium test suite for a ...
2
votes
3answers
3k views

Selecting element value from drop down list with selenium using POM

I'm trying to make simple test to register in website - https://www.midomi.com/. I'm using c# and selenium but have stuck in selecting values from dropdown list using Page object model. My project ...
0
votes
1answer
486 views

Cucumber - Feature file with page object model approach

I am totally new to cucumber, I am using page object model approach. Let's say I have 3 page and 3 test classes Ex: login Page.java / loginTest.java Registration Page.java/Registration Test.java ...
1
vote
1answer
97 views

Is there a C# equivalent for @FindAll in Java

Java's @FindAll allows the user to match at least one of the given criteria e.g. @FindAll({ @FindBy(className = "class1") @FindBy(className = "class2") }) private List<WebElement> ...
0
votes
1answer
199 views

NullPointerException in Webdriver/POM implementation

I have the code that is supposed to implement Page Object Model pattern using WebDriver. package com.practice; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa....