Questions tagged [page-objects]

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

Filter by
Sorted by
Tagged with
3
votes
1answer
22k views

How do I extract the inner element in Selenium?

I am new to Selenium and C#, which we are using right now. I am also new to using the Page Object model, to make our codes readable. Though I am having troubles using the FindsBy, so my original code ...
-1
votes
0answers
17 views

PageFactory.initElements give a null to webe elements in selenium

I am designing this framework to automate a web application using selenium and java. I have implemented bass class, object class and test class separately. even though I initialized the page factory ...
1
vote
4answers
114 views

How to initialise the PageObject Class using PageFactory only ONCE in a Step Definition Class in a Selenium Webdriver + Cucumber project?

I am making a Regression suite Automation project using Selenium Webdriver, Java, Cucumber, Maven etc. Now, the problem is that I have multiple Page Object classes that I initialise again and again ...
3
votes
1answer
574 views

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

I am practising 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 the ...
3
votes
1answer
110 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 ...
4
votes
1answer
1k views

Java + Selenium + log4j: How to write generic function for Logging in pagefactory? Possible?

I have written a selenium framework using page object design pattern. To make it better I am also using PageFactory. Example: BasePage.java @FindBy(xpath= FinalLocators.userName) WebElement uname; @...
2
votes
3answers
3k views

Selecting element value from drop down list with selenium using POM

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

How do I get the disabled state of a Submit button after click, but before page reload?

The code I am attempting to test prevents double submitting of a form by detecting the click event via Javascript and disabling the button. To clarify, the sequence of events is as follows: Navigate ...
1
vote
2answers
41 views

I created a small POM framework in selenium but it doesnt seem to be recognizing my locators in the Test and also multiple browsers are opened

Here are the details: Question 1 : When I run my test, locators are not identified from the locators file? why? But when I added the driver.findElement(By.) in my test , it identifies though. ...
-1
votes
2answers
5k views

Can we use Data Driven approach with Page Object model using Page Factory, any example or link will help

Can we use Data Driven approach with Page Object model using Page Factory, any example or link will help. I am trying to implement POM with PageFactory but at the same time I want to make it data ...
1
vote
1answer
2k views

Setting up Page Objects with python and seem to be getting every error possible

Project structure: WebTeam __init__.py BasePage.py UIMap.py Pages: __init__.py Common.py ContactPage.py test: __init__.py CompetitorsTest.py CreateAnonData.py ...
6
votes
3answers
510 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 ...
5
votes
4answers
935 views

Does page factory pattern improve Selenium test performance

Is there any major performance difference between the traditional way of finding web elements vs using the page factory pattern? public WebElement username=driver.findElement(username).sendKeys(...
0
votes
1answer
109 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 ...
1
vote
0answers
518 views

Page Object Design: Is there a Javascript equivalent to Ruby gem “site_prism”

I'd like to know if there is a framework in Javascript (NodeJS) for Protractor which supports a clean way to define the Page Object Elements on a Page Object as site_prism does. I've already checked ...
1
vote
1answer
930 views

WebDriver - Using loadablecomponent design for URLs with query parameters

For example, if the URL is - http://blah.com?origin=home&id=54&level=2. This could be a dynamically generated link on a webpage with 'id' and 'level' values from the DB. Now if I want to use ...
1
vote
0answers
142 views

How to inspect an element with multi attributes by OR operator in Page Objects model in watir?

I have a problem when trying to find an element with the different attribute as sample bellow <i>bold</i> Sometime <i class='icon'/i> I want to try inspecting this element with OR ...
21
votes
4answers
59k views

How to Implement Page Object and Page Factory Pattern in Selenium Webdriver?

I am a beginner in learning selenium Webdriver. I am not able to understand how page object and factory models works and how it can be beneficial? Kindly help me explain it with detailed explanation....
1
vote
1answer
26 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
52 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
663 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
99 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
67 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
46 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 ...
3
votes
1answer
298 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
0answers
181 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
114 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
433 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
votes
2answers
823 views

I am getting java.lang.NullPointerException while executing my test case

I am getting java.lang.NullPointerException while executing my test case , I am using Page Object Modle with PageFactory ,following are the code snippets TestBase Class: ackage com.base; import ...
2
votes
1answer
54 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
55 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 ...
0
votes
2answers
108 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 ...
2
votes
1answer
86 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
309 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 ...
4
votes
4answers
433 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
2answers
41 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 ...
3
votes
3answers
274 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 ...
0
votes
1answer
679 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
762 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.
2
votes
4answers
3k 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
2answers
992 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 ( ...
0
votes
1answer
572 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
101 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 ...
6
votes
1answer
194 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
2answers
311 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
3answers
470 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
74 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 ...
17
votes
4answers
7k views

Screen Play vs Page Object pattern

I've recently stumbled upon Senenity/JS framework which advocates the Screen Play pattern, which was proposed as a better alternative to Page Objects. What are the key fundamental differences between ...
2
votes
1answer
8k 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] ...
1
vote
1answer
905 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 ...