Questions tagged [page-objects]
Page Object is a design pattern used when creating browser automation.
182
questions
0
votes
1
answer
210
views
Playwright - Target Closed before any action
I am trying playwright and try to automate login feature. I have page classes, test classes and separate action class to write common actions like click,enter inputs.
My common action class
import { ...
-1
votes
1
answer
51
views
I am learning Page Model Object, i was trying to make this program work but i am getting the "NullPointerException" error everytime. can someone help
FrameWork code:
package FrameWorks;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support....
0
votes
1
answer
46
views
What should be in a base page object?
When building an automation framework some examples I see use a "Base Page" object that all other Page Objects derive from.
Typically these include a default constructor passing whatever ...
0
votes
1
answer
124
views
Page Object Model - Locators as functions vs constructor?
When creating a Page Object Model class (In this case i'll use JavaScript/TypeScript example) I see 2 typical ways of doing locators. Typically either something like this:
export class LoginPage {
...
0
votes
2
answers
483
views
How to by pass authentication(microsoft authenticator) while login into the website through selenium script
After passing login id and password, user must add code from mobile app - microsoft authenticator.
I want to bypass this code pop-up as I'm generating regression suite and it's not feasible to add ...
-1
votes
1
answer
2k
views
Can we get the text from the image using Selenium?
This is the path of the image from where I have to get the text shown on an image and into the text for security purposes,
@FindBy(xpath = "//img[@src=\"/register/tb135/tb_getimage.php?uid=...
-1
votes
2
answers
286
views
Is it mandatory to return a PageObject instance in every Page Object save/submit method?
In the Page Object model, we separate page UI elements and Test methods. However, there is a concept of Page chaining, in which we return an object on the next Page Object in the previous page object ...
0
votes
3
answers
1k
views
perform button click if specific element is present
I have a product list and some products have discount available. I want to click buy if discount price text is available.
Below is a product with discount
<article
class="commerce-product--...
0
votes
1
answer
717
views
Compilation stuck at find element by xpath without giving any error
I'm trying to automate a project using selenium page object model.
Below is the html code
<div class="type-1 overflow-hidden card"><div class="col-xl-8 offset-xl-2">&...
1
vote
1
answer
433
views
Why do we need to initialize Page Object class again in every Step of Cucumber scenario?
User user1;
Given("Add a new User profile")
public void addUser(){
PageFactory.initElements(driver, User.class);
user1.enterName(...);
}
Then("Edit a existing User profile")
...
1
vote
1
answer
598
views
Is it a good design to use a single Webdriver instance in Base Class and then each Page Object class inherits the driver instance in Cucumber Steps?
Im using Cucumber BDD framework with Selenium+Java. Now, I have made on BaseClass.Java in which i declare on public static WebDriver driver;
Now, in my .feature file i have many scenarios and in each ...
5
votes
6
answers
311
views
Is it necessary to have a very complex Automation framework?
I have seen many QA teams in many organization creating very complex and huge test automation frameworks and use concepts like Java reflections, use a lot utility classes, use many many dependencies/...
0
votes
2
answers
1k
views
Could not load type 'OpenQA.Selenium.Internal.IWrapsElement'
Could not load type 'OpenQA.Selenium.Internal.IWrapsElement' from assembly 'WebDriver, Version=4.0.0.0, Culture=neutral, PublicKeyToken=null'.
Stack Trace:
DefaultPageObjectMemberDecorator....
5
votes
4
answers
4k
views
Page Object Model from scratch: Best Practices?
Background
So I am sure this will probably get a lot of opinions but I am sure there are some things people with they thought of when starting to implement an automation framework from scratch, which ...
1
vote
0
answers
1k
views
How to perform mouse hover in selenium java using page object model approach?
I have automated some test cases mentioned at https://www.techlistic.com/2019/08/automate-buy-product-using-selenium.html For second test case mentioned at given link, I have written code for mouse ...
2
votes
3
answers
3k
views
Playwright: Implementing Page Object Patter into Framework
Recently I have been asking questions regarding Playwright and so far the community has been very helpful. I hope that my question and answers provided will be in use for people who are just starting ...
5
votes
1
answer
278
views
Which is the correct page object model design and why?
Issue:
The target webpage has many buttons in the page and adding separate abstraction for each method like , click button1 , button2 etc feels like unnecessary and just creates additional lines of ...
1
vote
1
answer
720
views
JavascriptExecutor.executeScript("arguments["+index+"].click();", elementName) does not work
I'm using IntelliJ IDEA 2020.1 Community Edition for automated testing. The issue seems simple enough. I have a Search drop-down menu which also contains a Search menu option (among other options).
...
3
votes
4
answers
229
views
How many tests to include when using Page object model
I've created a basic test for checking if some article is displayed and I have a question regarding Page object model. In my solution, I've testing page, base page, map page with element id's, and ...
3
votes
6
answers
168
views
Which is preferred in selenium, writing tests by page or functionality?
Should we write scripts that work 'page by page' or 'by functionality' which may mean several pages?
if it’s page by page how do we verify the success criteria for any element?
if it’s by ...
1
vote
4
answers
2k
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 ...
1
vote
2
answers
49
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.
...
2
votes
1
answer
801
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 ...
6
votes
4
answers
1k
views
Is the Page Object Pattern the ideal approach for browser automation for a website with a frontend that has nested 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
1
answer
46
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
1
answer
253
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 ...
9
votes
6
answers
1k
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
2
answers
283
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
2
answers
163
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
2
answers
65
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
0
answers
1k
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
1
answer
225
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
1
answer
710
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 ...
2
votes
1
answer
144
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
1
answer
158
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
1
answer
214
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 ...
7
votes
2
answers
699
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
2
answers
77
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
1
answer
242
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
1
answer
2k
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
3
answers
824
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.
4
votes
3
answers
818
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
4
answers
9k
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
1
answer
4k
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
1
answer
299
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 ...
3
votes
3
answers
1k
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
1
answer
166
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
2
answers
918
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 ...
3
votes
1
answer
15k
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
4
answers
1k
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 ...