New answers tagged

0

Your scenario is really long and include many things. Let break down it to smaller parts, example Search product Go to site Search with keyword Verify search result Compare product Go to product detail page Click "Compare this Product" button Verify something comparison page: price, quantity, ... it depends your purpose Checkout Go to product ...


0

In your BasePage.Java instead of creating a separate WebDriver object, you can use the WebDriver object of BasePage class directly by using (BasePage.driver) as below: public class LoginTC extends BasePage{ @Test public void login() { LoginPageObjects loginPage = PageFactory.initElements(BasePage.driver, LoginPageObjects.class); ...


1

The driver field in LoginTC hides the driver field from BasePage. The BasePage class fills in its own driver field, but LoginTC uses its own, which is never initialized. Solution: Remove the driver field from LoginTC, then either: Make the driver field in BasePage public or protected. Add a "getter" method (driver() or getDriver() or similar) to BasePage ...


0

If you are using Page Factory we need to initialize the Page Object: You can initialize with the help of below sample code: driver = new FirefoxDriver(); driver.get(baseUrl); Scorex_LoginTestCases loginTest = PageFactory.initElements(driver,Scorex_LoginTestCases.class); loginTest.Scorex_valid_email_password(); And please follow the conventions as method ...


1

On the Scorex_LoginTestCases (Btw, we do not use underscore in names in Java (See conventions), the objects objLogin and objHome are not initialized. On the TestBase, you should initialize them using the PageFactory's method initElements. You can see a sample here.


0

Page Factory Pattern is like an extension to Page Object Model , but Page Factory is much enhanced model. To start with, we just need to import package org.openqa.selenium.support.PageFactory "Factory class can be used to make using Page Objects simpler and easier". We use Page Factory pattern to initialize web elements which are defined in Page Objects. ...


0

In very simple terms, the explanation for page objects is as follows: A separate class (per page) which lists all the objects in a page and the allowed operations that can be performed by them can be created. And whenever you need to perform any tests on that particular page in your webapp, you write the test to first import the page, and thereafter, perform ...


0

A Page Object approach can be thought of as giving and using names for commonly used pieces of HTML pages. For example if you identify a button in three places this way: find('button#primary_driver_stage1') ... click('button#primary_driver_stage1') ... click('button#primary_driver_stage1') There are now three problems: It's hard to read It repeats some ...


2

Page Factory Pattern is like an extension to Page Object Model , but Page Factory is much enhanced model. To start with, we just need to import package org.openqa.selenium.support.PageFactory "Factory class can be used to make using Page Objects simpler and easier". We use Page Factory pattern to initialize web elements which are defined in Page Objects. ...



Top 50 recent answers are included