Questions tagged [pageobjects]

A commonly utilized design pattern that encapsulates a web page as an object, typically employed in UI and end-to-end testing, as well as browser automation.

Checking for URL redirection in Selenium automation can be done with the following steps

Attempting to automate the verification of top navigation links on . https://i.stack.imgur.com/Mt6Zw.png When comparing actual URLs with expected URLs in the page class method, the line below returns null. I'm not sure why. String urlp = locator.all_topn ...

What is the best way to eliminate the "driver" instance from the test classes?

Can someone assist me with this question: I am seeking guidance on how to eliminate the instance driver from the BaseTest class while still being able to utilize it in the class and its subclasses? I am currently using POM to construct a testing-framewor ...

What is the best way to set up a full class in C# using the PageObject design pattern?

Since the pageFactory is now deprecated in C#, I am curious about how to properly initialize classes in C#. I attempted to use @Findby to call them in the Testcase, but it resulted in a large number of objects being written. Is there a more efficient way? ...

From converting a path from a string to a WebElement

Currently, I have implemented the following method in my BasePage and I am looking to utilize this method in other pages as well. In this method, the parameter is currently set as (String xpathExpression). How can I modify it to accept a WebElement instea ...

What is the best location to place the "get current URL" method while implementing page objects in Selenium?

When attempting to confirm whether the current URL matches the homepage URL, is it recommended to include the logic for retrieving the current URL directly within the test method, as shown in let currentUrl = browser.getCurrentUrl();, or should this logic ...

Avoiding Selenium POM and TestNG NullPointerExceptions

I am currently working on automating my tests using web driver, testng, and the page factory. However, I have encountered a null pointer exception while executing the code provided below. HomePage Page Object Class This is the page factory class. packag ...

Establishing SpecFlow configuration to provide identifiers

As a newcomer to C#, I am exploring how to implement SpecFlow in a similar manner to how I utilized Gherkin, by assigning a unique name to an object and then invoking that name in the Step Definition. My main query pertains to incorporating the identifier ...

Implementing parallel execution with POM (Page Factory) for updating records

Looking for some help as I couldn't find a solution to my issue. I'm having trouble running tests in parallel using POM with page factory. *\ Testbase class */ public WebDriver driver; @BeforeClass @Parameters("Browsername&qu ...

Breaking down objects and actions within the page object model with Selenium

Currently, I am involved in creating a selenium-based automation framework. As part of this project, I have developed a Dashboard page that consists of over 100 different web elements, each requiring specific actions to be performed on them. My question ...

Verification of URL with Page Object Model (POM) in Nightwatch

Just diving into Nightwatch and JavaScript in general, I'm having trouble understanding how to validate a URL using the POM pattern. Any help or suggestions would be greatly appreciated! If you have any useful links for me to read through, that would ...

Does Page Object Design Pattern in Selenium involve the creation of page classes and the instantiation of their constructors through object references?

After setting up a Java Maven test project with Selenium, I am looking to transform it into the Page Object Design Pattern. It seems like we need to create classes for each page and then call them using objects in the main class based on what I've read in ...

Resolving a NullPointerException in Selenium Java JUnit Test Cases

Encountered a puzzling error while running a test in navigateAllMenus.java. When the script tries to locate loginLink, it halts and throws a java.lang.NullPointerException on line 28: _a_LoginPage.loginLink(driver).click();. Despite attempting different x ...

How can software design patterns be utilized for implementing branching logic?

Currently in my test automation, I've implemented a basic version of the Page Object Pattern. However, I've noticed that there is redundancy in my code. Within a single class, I have multiple methods that essentially perform the same task but return diffe ...

Is there a resource that provides a practical example of Java combined with Selenium and PageObject implementation?

While I have some basic experience with Selenium and Java, I am now seeking to delve deeper into the Page Object Pattern. However, I am having difficulty grasping how to effectively implement it in a real project. Despite my efforts to find straightforward ...

Tips for isolating page components and code logic in Selenium using Java

I am currently learning how to separate locators from the actual code in Selenium. I have managed to separate them so far, but I would like some guidance on optimizing the code further. Can the Page Object design model be used to not only store locators bu ...

Obtaining locator information from a WebElement and implementing it with the PageFactory

When designing my web application, I adhere to the Page object model by utilizing a Base class that contains all common and reusable methods, as well as separate pages for each page of the application. Currently, I am faced with the task of creating a met ...

Guide on verifying the clickability of a button with selenium webdriver

I am currently working on determining whether or not the button element is clickable, however I am facing difficulties in successfully validating this using Selenium WebDriver. Below is the code snippet I am using to validate if the element is clickable: ...

Is it possible for IList<IWebElement> to be compatible with PageObjects?

I am currently using a simple loop to click test a list of items. The loop is functioning smoothly, but I am wondering if it is possible to incorporate Page-Object design into this. I have searched for examples of others doing something similar but have ...

Ways to identify a group of elements within a page object without creating an individual element for each one

I am looking to access a series of elements with similar IDs ranging from 1 to 47. Rather than individually specifying each element, is there a more efficient way to create an array or list for easy iteration? [FindsBy(How = How.Id, Using = "ElementId1")] ...

Encountering 'Element not found' error when automating Flight Booking on MakeMyTrip.com using Selenium WebDriver, specifically while trying to select a flight after conducting a search

Currently in the process of automating the flight booking feature on MakeMyTrip.com using Selenium WebDriver. I have implemented separate classes for Page Object Model (POM) and TestNG. The code successfully automates the process up to the point of clicki ...

Tips for sharing a single driver instance in the Page Object Model

My automation framework utilizes selenium, TestNG, and the PageObject model. In terms of structure: https://i.stack.imgur.com/xLPYB.png For my Testng class / test case: https://i.stack.imgur.com/WFM3p.png I encountered a null pointer error https://i.s ...

When conducting tests with the Page Factory Design and Page Object Model, two browser instances are launched using Selenium and Java

I am facing an issue with my Selenium WebDriver test using the Page Object Model. When I run the test, it opens two windows in the Chrome browser, with the first window being empty in the URL bar. How can I make it open only one window with the onet.pl URL ...

Steps for displaying custom element name from Page Object Model in test report log

To accurately track user interactions, I require the WebElement name (User-defined) for reporting purposes. When performing a Click operation on AddMainConcernLink, I need to report whether the element was successfully clicked or not as "AddMainConcernLink ...

Developing a Page Object Model to automate testing across a variety of web

I currently have a Test automation tool and we are looking to implement the page object model for automating testing on our web applications. From what I understand, the page object model is ideal when you have only one application to test. However, we h ...