|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.saucelabs.selenium.client.client.factory.SeleniumFactory
public class SeleniumFactory
Factory of Selenium.
Compared to directly initializing DefaultSelenium, this additional indirection
allows the build script or a CI server to control how you connect to the selenium.
This makes it easier to run the same set of tests in different environments without
modifying the test code.
This is analogous to how you connect to JDBC — you normally don't directly
instantiate a specific driver, and instead you do DriverManager.getConnection(String).
| Constructor Summary | |
|---|---|
SeleniumFactory()
|
|
| Method Summary | |
|---|---|
SeleniumFactory |
clone()
Creates a clone of this factory that's identically configured. |
static com.thoughtworks.selenium.Selenium |
create()
Uses a driver specified by the 'SELENIUM_DRIVER' system property or the environment variable, and run the test against the domain specified in 'SELENIUM_STARTING_URL' system property or the environment variable. |
static com.thoughtworks.selenium.Selenium |
create(java.lang.String browserURL)
Uses a driver specified by the 'SELENIUM_DRIVER' system property or the environment variable, and run the test against the specified domain. |
static com.thoughtworks.selenium.Selenium |
create(java.lang.String driverUri,
java.lang.String browserURL)
Uses the specified driver and the test domain and create a driver instance. |
com.thoughtworks.selenium.Selenium |
createSelenium()
Based on the current configuration, instantiate a Selenium driver and returns it. |
com.thoughtworks.selenium.Selenium |
createSelenium(java.lang.String browserURL)
Based on the current configuration, instantiate a Selenium driver and returns it. |
java.lang.ClassLoader |
getClassLoader()
Gets the classloader set by the setClassLoader(ClassLoader). |
java.util.Map<java.lang.String,java.lang.Object> |
getProperties()
Returns the live map that stores the property values. |
java.lang.Object |
getProperty(java.lang.String key)
Retrieves the value of the property previously set. |
java.lang.String |
getUri()
Gets the driver URI set by the setUri(String) |
SeleniumFactory |
setClassLoader(java.lang.ClassLoader cl)
Sets the classloader used for searching the driver. |
SeleniumFactory |
setProperty(java.lang.String key,
java.lang.Object value)
Sets other misc. |
SeleniumFactory |
setUri(java.lang.String uri)
Sets the URI of the Selenium driver. |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public SeleniumFactory()
| Method Detail |
|---|
public static com.thoughtworks.selenium.Selenium create()
If exists, the system property takes precedence over the environment variable.
This is just a convenient short-cut for new SeleniumFactory().createSelenium().
public static com.thoughtworks.selenium.Selenium create(java.lang.String browserURL)
If exists, the system property takes precedence over the environment variable.
This is just a convenient short-cut for new SeleniumFactory().createSelenium(browserURL).
browserURL - See the parameter of the same name in DefaultSelenium.DefaultSelenium(String, int, String, String).
This specifies the domain name in the format of "http://foo.example.com" where the test occurs.
public static com.thoughtworks.selenium.Selenium create(java.lang.String driverUri,
java.lang.String browserURL)
This is just a convenient short-cut for new SeleniumFactory().setUri(driverUri).createSelenium(browserURL).
driverUri - The URI indicating the Selenium driver to be instantiated.browserURL - See the parameter of the same name in DefaultSelenium.DefaultSelenium(String, int, String, String).
This specifies the domain name in the format of "http://foo.example.com" where the test occurs.public java.lang.String getUri()
setUri(String)
public SeleniumFactory setUri(java.lang.String uri)
Initially, the value of the 'SELENIUM_DRIVER' system property of the environment variable is read and set. The system property takes precedence over the environment variable.
public java.lang.ClassLoader getClassLoader()
setClassLoader(ClassLoader).
public SeleniumFactory setClassLoader(java.lang.ClassLoader cl)
Thread.currentThread().getContextClassLoader() of the thread
that instantiated this factory.
public SeleniumFactory setProperty(java.lang.String key,
java.lang.Object value)
public java.lang.Object getProperty(java.lang.String key)
public java.util.Map<java.lang.String,java.lang.Object> getProperties()
public SeleniumFactory clone()
Properties are only shallowly copied.
clone in class java.lang.Objectpublic com.thoughtworks.selenium.Selenium createSelenium()
This version implicitly retrieves the 'browserURL' parameter and
calls into createSelenium(String) by checking the 'SELENIUM_STARTING_URL'
system property or the environment variable. The system property takes precedence over the environment variable.
java.lang.IllegalArgumentException - if the configuration is invalid, or the driver failed to instantiate.public com.thoughtworks.selenium.Selenium createSelenium(java.lang.String browserURL)
java.lang.IllegalArgumentException - if the configuration is invalid, or the driver failed to instantiate.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||