Questions tagged [page-factory]
page factory is an approach used to initialize webelements in Class of a page-object-model of selenium.
39
questions
0
votes
1answer
35 views
Appium Pagefactory throws noSuchMethodException when running from POM
When I try to run my appium scripts on the pom file ( with mvn verify or mvn test)
I get a
java.lang.RuntimeException: java.lang.NoSuchMethodException: jdk.proxy2.$Proxy12.proxyClassLookup()
On the ...
0
votes
1answer
30 views
Dynamic xpath in page factory appium
public static WebElement selectcity(String cityname)
{
@AndroidFindBy(xpath="//android.widget.CheckedTextView[@text='"+cityname+"']")
WebElement city;
return city;
}...
1
vote
0answers
37 views
Is each Scenario in Cucumber BDD framework considered a separate .Java Class by JVM?
When I write Cucumber scenario's like:-
User.java Feature File
Scenario: Add a new user profile
Given User is on the Add user profile page
When user enters profile information and clicks ...
1
vote
4answers
423 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 ...
0
votes
0answers
177 views
[[TestNGClassFinder]] Unable to read methods on class
[[TestNGClassFinder]] Unable to read methods on class package.CreateCustomer - unable to resolve class reference org/openqa/selenium/WebDriver
I have created a testNG program and run the program using ...
0
votes
1answer
47 views
java.lang.NullPointerException in Page object Model
I have created this program using TestNG and i'm getting this error java.lan*g.NullPointerException
I have initialized the Webelement .But still i'm getting error
POM.java
package TestPOM;
import java....
0
votes
3answers
401 views
What is the purpose of creating a BaseTest class which declares a global static WebDriver object in POM framework?
I am a newbie in Selenium Automation.
I don't understand the concept of creating a "BaseTest" class which has one static Webdriver. I always get confused on this concept and end up creating multiple ...
0
votes
3answers
1k views
Why is WebDriver instance declared static in Page Object model structure in Selenium?
I am a complete newbie in Selenium and java in general. I am trying to use the Page object model with Page factory to create Page object class for the Login page of an application. I am reading lot of ...
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.
...
4
votes
1answer
511 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
3answers
1k views
How to get value of WebElement init in PageFactory?
For example:
@FindBy(xpath = "//div[@id='panel']//span[@class='name']")
private WebElement panel;
I've got a panel element. Is it possible to get value of XPath that I init above?
I need a solution ...
1
vote
1answer
175 views
Is there a way to disable the logs created by the pagefactory
Could someone please let me know if there is any way we can disable the logs generated by the page factory for Chrome and Firefox
I did try the below options for chrome and firefox and I had also ...
0
votes
1answer
256 views
Null PointerException on TESTNG ,pagefactory
LoginPage.Java
package TestCases;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.support.PageFactory;
import org.testng.annotations.Test;
import ObjectRepository....
0
votes
1answer
136 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
957 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....
0
votes
1answer
105 views
Compilation error when extending class and defining a method
I am getting compilation error when I am extending Loginpage class through Loginbusiness, define a method but compilation throws an error to remove illegal identifiers(eg. public) and also for ...
2
votes
4answers
4k 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 ...
-2
votes
1answer
744 views
How to assert that particular element is not displayed? [duplicate]
Can someone help me fixing NoSuchElementException. Let me explain what I am trying to do.
I am trying to login into an application with multiple sets of data. Lets say,
1) Valid username and ...
-1
votes
1answer
276 views
Getting “java.lang.NullPointerException” exception when i try to run my POM test [duplicate]
I have 2 classes in my project
First class contains all the webelements
Second one for method where i am using this elements
package facebook;
import org.openqa.selenium.By;
import org.openqa....
1
vote
2answers
2k views
The name PageFactory does not exist in current context
I am using a POM in C# with Xunit as a framework, and am getting error in pagefactory for the following code:
PageFactory.InitElements(driver, login);
Error: "The name PageFactory does not exist ...
3
votes
1answer
10k 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
1answer
741 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 ...
1
vote
1answer
1k 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 ...
3
votes
1answer
114 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
692 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.
...
1
vote
1answer
625 views
How to pass the data provider data when page factory method is applied
I have created a sample project using the page factory. Now I want to use the data provider in the code and this is how I have done below. Is the approach correct?
I have defined CommonElements class ...
3
votes
1answer
322 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 ...
2
votes
3answers
93 views
Element is not identifed in the second test method
I have a strange behavior : I created Test Class with 2 Test Methods as below.
When I call AddLimitedBuyOrderwithRandom in the first method it works fine without any exception, but if I call ...
0
votes
2answers
115 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
2answers
1k 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
147 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 ...
0
votes
5answers
2k views
How to locate “Login” button of Flipkart bootstrap login page? I tried in many ways, but still unable to locate element
Below are three options I tried, but I'm not able to locate Login button. When I tried using seleniumIDE, I got this xpath=(//button[@type='submit'])[2]
But its not working in Webdriver. Can someone ...
0
votes
2answers
4k views
How to wait presence of elements in page factory
I'm using page factory and need to explicitly wait until particulate elements load. Please advise how to do that. up to now I have following..
public class HomePage {
final WebDriver driver;
...
1
vote
2answers
2k views
What are the other ways of storing and accessing the webelement(locators) during automation testing
I'm aware and have also used two ways of storing the WebElements/locators (a.k.a Object Repository)
External File (example: .properties , .yaml, .xml, etc...or any other file type)
Using page ...
0
votes
2answers
55 views
How to retrieve a variable from one page and pass the same in another page
Is there any possibility to fetch a unique value from one page and search the same unique number in the other page?
Workflow:
1.Entering details in a webpage (while entering the details, a unique ...
7
votes
1answer
3k views
POM vs PageFactory
I'm starting my career as a QA Automation Engineer coming from a Jr dev background. I noticed that there are two main design patterns for Selenium, POM and PageFactory.
Which is the preferred design ...
0
votes
1answer
1k views
How to pass data through Excel sheet in Page Factory framework
I have created a login test script and verified home page also but now I have to add new customer and the form accepts following values
Customer Name
Gender
Date Of Birth
Customer Address , city, ...
5
votes
4answers
989 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(...
2
votes
4answers
3k views
Will the variable be still referencing the same webelement on page after page refresh, while using PageFactory
I use Page object pattern with Page Factory in selenium Webdriver with Java (as language).
Will my inputSearch variable be still referencing to the same webelement on page, after refreshing the ...