|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.unitils.selenium.WebDriverModule
public class WebDriverModule
This module creates new WebDrivers.
| Nested Class Summary | |
|---|---|
class |
WebDriverModule.WebdriverTestlistener
|
| Field Summary | |
|---|---|
static java.lang.String |
BASE_URL_KEY
property Unitils.properties: defines the base url. |
static java.lang.String |
BROWSER_NAME_KEY
property Unitils.properties: defines the browser. |
static java.lang.String |
CHROME_BINARY_KEY
property Unitils.properties: defines the location of the chrome binary. |
static java.lang.String |
CHROME_DRIVER_KEY
property Unitils.properties: defines the location of the chrome driver. |
static java.lang.String |
DOWNLOADPATH
property Unitils.properties: defines the folder where all the downloads are saved. |
static java.lang.String |
FILETYPE
property Unitils.properties: defines all the downloadable types. |
static java.lang.String |
FIREFOX_BINARY_KEY
property Unitils.properties: defines the location of the firefox binary. |
static java.lang.String |
IE_BINARY_KEY
property Unitils.properties: defines location of the IE binary. |
static java.lang.String |
LIST_AUTOMATICALLY_DOWNLOAD
default value FILETYPE. |
static java.lang.String |
LOGGING_FILE_PROP
property Unitils.properties: all the info should be logged into a file? |
static java.lang.String |
LOGGINGPROP_BROWSER
property Unitils.properties: should the browser info from selenium be logged? |
static java.lang.String |
LOGGINGPROP_CLIENT
property Unitils.properties: should the client info from selenium be logged? |
static java.lang.String |
LOGGINGPROP_CONSOLE_ENABLED
property Unitils.properties: defines if unitils-selenium should log the selenium logs in the console. |
static java.lang.String |
LOGGINGPROP_DRIVER
property Unitils.properties: should the driver info from selenium be logged? |
static java.lang.String |
LOGGINGPROP_IE
property Unitils.properties: all the IE info must be logged? |
static java.lang.String |
LOGGINGPROP_PERFORMANCE
property Unitils.properties: should the performance info from selenium be logged? |
static java.lang.String |
LOGGINGPROP_PROFILER
property Unitils.properties: should the profiler info from selenium be logged? |
static java.lang.String |
LOGGINGPROP_SERVER
property Unitils.properties: should the server info from selenium be logged? |
protected static java.lang.String |
PACKAGENAME
base package unitils-selenium. |
static java.lang.String |
PROXY_HOST_KEY
property Unitils.properties: defines the proxy. |
static java.lang.String |
REMOTE_CAPABILITIES
|
static java.lang.String |
REMOTE_URL_KEY
|
static java.lang.String |
TARGETSUREFIREREPORTS
location surefirereports. |
| Constructor Summary | |
|---|---|
WebDriverModule()
|
|
| Method Summary | |
|---|---|
void |
afterInit()
|
protected void |
checkChromeDriver(java.lang.String bit,
java.lang.ClassLoader classLoader)
This method checks if the location of the chrome driver is already in the system. |
protected void |
checkFirefoxDriver()
This method checks if their is a system property 'webdriver.firefox.bin' and checks if it exists. |
protected void |
checkIEDriver(java.lang.String bit,
java.lang.ClassLoader classLoader)
This method checks if there is a system property 'webdriver.ie.driver' and checks if the location exists. |
boolean |
checkIfDriverIsAlreadyInSystem(java.lang.String systemProp,
java.lang.String driver,
java.lang.String systemVarDriver)
Check if the system variable already exists in the system and check if the variable is a valid location. |
boolean |
checkIfDriverPropertyExistsInUnitilsProperties(java.lang.String key,
java.lang.String driver,
java.lang.String systemKey)
Check if the key exists in the unitils.properties and check if the value for that key is a valid location. |
java.lang.String |
copyDriverIntoNewTempFile(java.net.URL url,
java.lang.String name)
Copies the driver into a new temp file. |
protected static java.lang.String |
createLogNewDriver(java.lang.String systemVarDriver,
java.lang.String absPath)
logmessage: The driver in unitils-selenium is used. |
protected static java.lang.String |
getAbsoluteDownloadPath(java.lang.String path)
Checks if the file exists and returns the absolute path of the location. |
protected java.lang.Object |
getElement(org.openqa.selenium.WebDriver webdriver,
java.lang.Class<?> type)
This is the actual method that creates an object of the correct type and initialises all the elements. |
org.unitils.core.TestListener |
getTestListener()
|
void |
init(java.util.Properties configuration)
|
void |
initBaseUrl(java.lang.Object testObject)
All the elements with the @BaseUrlString will be initialised with the base url value of the unitils.properties. |
void |
initElements(java.lang.Object testObject)
* Searches all the fields with the WebPage annotation and sets the correct elements. |
void |
initWebDriver(java.lang.Object testObject)
Initialises the webdriver. |
protected void |
killWebDriver(java.lang.Object testObject)
All the webdrivers (all the fields with the TestWebDriver of the testObject will be killed. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static final java.lang.String PACKAGENAME
public static final java.lang.String BROWSER_NAME_KEY
public static final java.lang.String REMOTE_CAPABILITIES
public static final java.lang.String BASE_URL_KEY
public static final java.lang.String REMOTE_URL_KEY
public static final java.lang.String PROXY_HOST_KEY
public static final java.lang.String DOWNLOADPATH
public static final java.lang.String FILETYPE
public static final java.lang.String LIST_AUTOMATICALLY_DOWNLOAD
FILETYPE.
public static final java.lang.String FIREFOX_BINARY_KEY
public static final java.lang.String IE_BINARY_KEY
public static final java.lang.String CHROME_DRIVER_KEY
public static final java.lang.String CHROME_BINARY_KEY
public static final java.lang.String LOGGINGPROP_CONSOLE_ENABLED
public static final java.lang.String LOGGINGPROP_PERFORMANCE
public static final java.lang.String LOGGINGPROP_BROWSER
public static final java.lang.String LOGGINGPROP_CLIENT
public static final java.lang.String LOGGINGPROP_DRIVER
public static final java.lang.String LOGGINGPROP_PROFILER
public static final java.lang.String LOGGINGPROP_SERVER
public static final java.lang.String LOGGING_FILE_PROP
public static final java.lang.String LOGGINGPROP_IE
public static final java.lang.String TARGETSUREFIREREPORTS
| Constructor Detail |
|---|
public WebDriverModule()
| Method Detail |
|---|
public void init(java.util.Properties configuration)
init in interface org.unitils.core.Modulepublic void afterInit()
afterInit in interface org.unitils.core.Modulepublic void initWebDriver(java.lang.Object testObject)
TestWebDriver and uses the browser choice (in
unitils.properties) to create the driver.
testObject - : the testobject.protected static java.lang.String getAbsoluteDownloadPath(java.lang.String path)
path - : the relative or absolute path of a file.
Stringprotected void killWebDriver(java.lang.Object testObject)
TestWebDriver of the testObject will be killed.
testObject - : the testobject.public void initBaseUrl(java.lang.Object testObject)
testObject - : the testobject.public void initElements(java.lang.Object testObject)
WebPage annotation and sets the correct elements.
testObject - : the testobject.
protected void checkChromeDriver(java.lang.String bit,
java.lang.ClassLoader classLoader)
CHROME_DRIVER_KEY is defined in the unitils.properties. If there isn't a valid location in the system or
in the unitils.properties than this method will use the driver that is added with unitils.selenium.
bit - : should be 32 or 64classLoader - : the classloader used by this class.protected void checkFirefoxDriver()
FIREFOX_BINARY_KEY in the unitils.properties.
protected void checkIEDriver(java.lang.String bit,
java.lang.ClassLoader classLoader)
IE_BINARY_KEY in your unitils.properties. The last option is
that it uses the driver that is given by unitils-selenium.
bit - : should be 32 or 64classLoader - : the classloader used by this class.
public boolean checkIfDriverIsAlreadyInSystem(java.lang.String systemProp,
java.lang.String driver,
java.lang.String systemVarDriver)
systemProp - : the location of the driver in the system.driver - : the name of the driver.systemVarDriver - : the name of the system property.
public boolean checkIfDriverPropertyExistsInUnitilsProperties(java.lang.String key,
java.lang.String driver,
java.lang.String systemKey)
key - : the key to find the correct driver location in the unitils.properties.driver - : the type of driver.systemKey - : the system key where the module should set the new location of the driver.
public java.lang.String copyDriverIntoNewTempFile(java.net.URL url,
java.lang.String name)
url - : the location of the driver.name - : the name of the driver.
String
protected java.lang.Object getElement(org.openqa.selenium.WebDriver webdriver,
java.lang.Class<?> type)
webdriver - : should be of type WebDrivertype: - the class that should be initialised.
Objectpublic org.unitils.core.TestListener getTestListener()
getTestListener in interface org.unitils.core.Module
protected static java.lang.String createLogNewDriver(java.lang.String systemVarDriver,
java.lang.String absPath)
systemVarDriver - : the system key of the driver.absPath - : the value of the system key of the driver.
String
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||