public class CustomPageFactory
extends org.openqa.selenium.support.PageFactory
PageFactory
of selenium.
This class enhances the PageFactory implementation provided by Selenium by providing an enhanced feature of storing locators onto a different file and fetching it from the file based on the keyword provided at runtime.
Constructor and Description |
---|
CustomPageFactory() |
Modifier and Type | Method and Description |
---|---|
static <T> T |
initElements(Browser browser,
Class<T> pageClassToProxy)
Custom Page Factory method that initializes the Selenium PageFactory based element locators
PageFactory
with the passed driver object. |
static <T> T |
initElements(Browser browser,
Class<T> pageClassToProxy,
File file)
Custom Page Factory method that initializes the Selenium PageFactory based element locators
PageFactory
with the passed browser object. |
static <T> T |
initElements(Browser browser,
Class<T> pageClassToProxy,
String filePath)
Custom Page Factory method that initializes the Selenium PageFactory based element locators
PageFactory
with the passed browser object. |
static <T> T |
initElements(Browser browser,
T pageClassObjectToProxy)
As
PageFactory.initElements(org.openqa.selenium.WebDriver, Class)
but will use the TAF Browser class object for getting the driver. |
static <T> T |
initElements(Browser browser,
T pageClassObjectToProxy,
File file)
Custom Page Factory method that initializes the Selenium PageFactory based element locators
PageFactory
with the passed browser object. |
static <T> T |
initElements(Browser browser,
T pageClassObjectToProxy,
String filePath)
Custom Page Factory method that initializes the Selenium PageFactory based element locators
PageFactory
with the passed driver object. |
static void |
initElements(org.openqa.selenium.support.pagefactory.ElementLocatorFactory factory,
Object page)
Initialize the elements of web element ,list
|
static <T> T |
initElements(org.openqa.selenium.WebDriver driver,
Class<T> pageClassToProxy)
Custom Page Factory method that initializes the Selenium PageFactory based element locators
PageFactory
with the passed driver object. |
static <T> T |
initElements(org.openqa.selenium.WebDriver driver,
Class<T> pageClassToProxy,
File file)
Custom Page Factory method that initializes the Selenium PageFactory based element locators
PageFactory
with the passed driver object. |
static <T> T |
initElements(org.openqa.selenium.WebDriver driver,
Class<T> pageClassToProxy,
String filePath)
Custom Page Factory method that initializes the Selenium PageFactory based element locators
PageFactory
with the passed driver object. |
static <T> T |
initElements(org.openqa.selenium.WebDriver driver,
T pageClassObjectToProxy,
File file)
Custom Page Factory method that initializes the Selenium PageFactory based element locators
PageFactory
with the passed browser object. |
static <T> T |
initElements(org.openqa.selenium.WebDriver driver,
T pageClassObjectToProxy,
String filePath)
Custom Page Factory method that initializes the Selenium PageFactory based element locators
PageFactory
with the passed driver object. |
public static <T> T initElements(org.openqa.selenium.WebDriver driver, Class<T> pageClassToProxy, File file)
PageFactory
with the passed driver object.
Note: Use this method when you are not using the page object model.\n
If using the Page Object model supported by the given framework, try to use the method
initElements(Browser, Class, File)
.
driver
- Driver object which should be used to initialize the Page Factory elements.pageClassToProxy
- A class which will be initialized.file
- File
object of the file containing the key/value pair.public static <T> T initElements(Browser browser, Class<T> pageClassToProxy, File file)
PageFactory
with the passed browser object.
Note: Only use this method when you are using the page object model.
If you are not using the Page Object model , try to use the method
initElements(WebDriver, Class, File)
.
browser
- Browser object which should be used to initialize the Page Factory elements.pageClassToProxy
- A class which will be initialized.file
- File
object of the file containing the key/value pair.public static <T> T initElements(Browser browser, Class<T> pageClassToProxy, String filePath)
PageFactory
with the passed browser object.
Note: Only use this method when you are using the page object model.
If you are not using the Page Object model , try to use the method
initElements(WebDriver, Class, String)
.
browser
- Browser object which should be used to initialize the Page Factory elements.pageClassToProxy
- A class which will be initialized.filePath
- File path of the file containing the key/value pair.public static <T> T initElements(org.openqa.selenium.WebDriver driver, Class<T> pageClassToProxy, String filePath)
PageFactory
with the passed driver object.
Note: Use this method when you are not using the page object model.\n
If using the Page Object model supported by the given framework, try to use the method
initElements(Browser, Class, File)
.
driver
- Driver object which should be used to initialize the Page Factory elements.pageClassToProxy
- A class which will be initialized.filePath
- File path of the file containing the key/value pair.public static <T> T initElements(org.openqa.selenium.WebDriver driver, T pageClassObjectToProxy, File file)
PageFactory
with the passed browser object.
Note: Only use this method when you are using the page object model.
If you are using the Page Object model , try to use the method
initElements(Browser, Object, File)
.
driver
- Driver object which should be used to initialize the Page Factory elements.pageClassObjectToProxy
- A class object which have to be initialized.file
- File
object of the file containing the key/value pair.public static <T> T initElements(Browser browser, T pageClassObjectToProxy, File file)
PageFactory
with the passed browser object.
Note: Only use this method when you are using the page object model.
If using not using the Page Object model , try to use the method
initElements(WebDriver, Object, File)
.
browser
- Browser object which should be used to initialize the Page Factory elements.pageClassObjectToProxy
- A class object which have to be initialized.file
- File
object of the file containing the key/value pair.public static void initElements(org.openqa.selenium.support.pagefactory.ElementLocatorFactory factory, Object page)
factory
- page
- public static <T> T initElements(org.openqa.selenium.WebDriver driver, T pageClassObjectToProxy, String filePath)
PageFactory
with the passed driver object.
Note: Use this method when you are not using the page object model.\n
If using the Page Object model supported by the given framework, try to use the method
initElements(Browser, Object, String)
.
driver
- Driver object which should be used to initialize the Page Factory elements.pageClassObjectToProxy
- A class object which have to be initialized.filePath
- File path of the file containing the key/value pair.public static <T> T initElements(Browser browser, T pageClassObjectToProxy, String filePath)
PageFactory
with the passed driver object.
Note: Use this method when you are not using the page object model.\n
If note using the Page Object model supported by the given framework, try to use the method
initElements(WebDriver, Object, String)
.
browser
- Browser object which should be used to initialize the Page Factory elements.pageClassObjectToProxy
- A class object which have to be initialized.filePath
- File path of the file containing the key/value pair.public static <T> T initElements(Browser browser, T pageClassObjectToProxy)
PageFactory.initElements(org.openqa.selenium.WebDriver, Class)
but will use the TAF Browser class object for getting the driver.browser
- Browser object which should be used to initialize the Page Factory elements.page
- The object with WebElement and Listpublic static <T> T initElements(org.openqa.selenium.WebDriver driver, Class<T> pageClassToProxy)
PageFactory
with the passed driver object.
This method tries to get the default locator file for a class by calling the "getLocatorFile" method if available in the said class.
If the said method is available it will use the file returned by the method for getting selectors.
If there is no method defined in the class it will initialize the said class as a Normal Page Factory class and will consider the Page Factory annotations "using" attribute value as a selector for identifying the elements.
Note: Use this method when you are not using the page object model.\n
If using the Page Object model supported by the given framework, try to use the method
initElements(Browser, Class)
.
driver
- Driver object which should be used to initialize the Page Factory elements.pageClassToProxy
- A class which will be initialized.public static <T> T initElements(Browser browser, Class<T> pageClassToProxy)
PageFactory
with the passed driver object.
This method tries to get the default locator file for a class by calling the "getLocatorFile" method if available in the said class.
If the said method is available it will use the file returned by the method for getting selectors.
If there is no method defined in the class it will initialize the said class as a Normal Page Factory class and will consider the Page Factory annotations "using" attribute value as a selector for identifying the elements.
Note: Use this method when you are not using the page object model.\n
If not using the Page Object model supported by the given framework, try to use the method
initElements(WebDriver, Class)
.
pageClassToProxy
- A class which will be initialized.Copyright © 2014. All rights reserved.