public class CacheDriverFactory extends Object
CacheDriverFactory
provides a utility for creating and maintaining Selenium WebDriver
instance.
The framework supports an in-build implementation of driver creation as well as provide the flexibility to allow user to provide his own driver implementation.
In-build driver supports firefox,ie,chrome,htmlunit. Thes values can be set to the property test.name inside taf.properties file. For user defined driver, User have to implement a class implementing theIDriverProvider
interface and add the path to the said class onto
the property userdefined.driverclass inside taf.properties file.
The class provides two different implementation of driver factory:
Constructor and Description |
---|
CacheDriverFactory()
Default Constructor which will create the CacheDriverFactory object and uses the default config class object.
|
CacheDriverFactory(DefaultConfig config)
Default Constructor which will create the CacheDriverFactory object using the
DefaultConfig class object provided. |
Modifier and Type | Method and Description |
---|---|
static void |
clearCacheAndQuitDriver()
Clears the current driver from the factory and then quits the said driver object
|
org.openqa.selenium.WebDriver |
clearDriver()
Clears the current driver from the factory and return the old driver back
|
org.openqa.selenium.WebDriver |
getDriver()
Create or return the current driver based on the configuration provided inside the taf.properties file.
|
IDriverProvider |
getDriverProvider()
Returns the driver provider to be used for the execution.
|
boolean |
getThreadBasedDriver()
Return true or false based on the condition whether the driver object is thread based or not
|
IDriverProvider |
getUserDefinedDriverProvider()
Returns the Driver Provider class object of the class that has been provided by the user for Driver creation
|
void |
setDriverProvider(IDriverProvider driverProvider)
Sets the Driver Provider
|
void |
setThreadBasedDriver(boolean value)
Sets the thread based driver configuration with the given value.
|
public CacheDriverFactory()
public CacheDriverFactory(DefaultConfig config)
DefaultConfig
class object provided.config
- DefaultConfig
class object that needs to be used by this class.public boolean getThreadBasedDriver()
public void setThreadBasedDriver(boolean value)
value
- public org.openqa.selenium.WebDriver getDriver()
WebDriver
objectpublic org.openqa.selenium.WebDriver clearDriver()
WebDriver
objectpublic static void clearCacheAndQuitDriver()
public IDriverProvider getUserDefinedDriverProvider()
IDriverProvider
object or null if no class have been defined.public IDriverProvider getDriverProvider()
InbuiltDriverProvider
class instance.IDriverProvider
object of the driver provider class.public void setDriverProvider(IDriverProvider driverProvider)
driverProvider
- A IDriverProvider implementation objectCopyright © 2014. All rights reserved.