Package net.thucydides.core.webdriver
Class WebDriverFactory
java.lang.Object
net.thucydides.core.webdriver.WebDriverFactory
public class WebDriverFactory
extends java.lang.Object
Provides an instance of a supported WebDriver.
When you instantiate a WebDriver instance for Firefox or Chrome, it opens a new browser.
- Author:
- johnsmart
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
DEFAULT_DRIVER
static java.lang.String
REMOTE_DRIVER
-
Constructor Summary
Constructors Constructor Description WebDriverFactory()
WebDriverFactory(EnvironmentVariables environmentVariables)
WebDriverFactory(EnvironmentVariables environmentVariables, FixtureProviderService fixtureProviderService)
WebDriverFactory(EnvironmentVariables environmentVariables, FixtureProviderService fixtureProviderService, SaucelabsRemoteDriverCapabilities saucelabsRemoteDriverCapabilities, TimeoutStack timeoutStack, CloseBrowser closeBrowser)
-
Method Summary
Modifier and Type Method Description java.time.Duration
currentTimeoutFor(org.openqa.selenium.WebDriver proxiedDriver)
static java.lang.String
getBrowserStackDriverFrom(EnvironmentVariables environmentVariables)
java.lang.Class<? extends org.openqa.selenium.WebDriver>
getClassFor(SupportedWebDriver driverType)
java.time.Duration
getDefaultImplicitTimeout()
static java.lang.String
getDriverFrom(EnvironmentVariables environmentVariables)
static java.lang.String
getDriverFrom(EnvironmentVariables environmentVariables, java.lang.String defaultDriver)
static java.lang.String
getSaucelabsDriverFrom(EnvironmentVariables environmentVariables)
static boolean
isAlive(org.openqa.selenium.WebDriver driver)
static boolean
isNotAlive(org.openqa.selenium.WebDriver driver)
org.openqa.selenium.WebDriver
newInstanceOf(SupportedWebDriver driverType)
Create a new WebDriver instance of a given type.protected org.openqa.selenium.WebDriver
newWebdriverInstance(java.lang.Class<? extends org.openqa.selenium.WebDriver> driverClass)
This method is synchronized because multiple webdriver instances can be created in parallel.protected org.openqa.selenium.WebDriver
newWebdriverInstance(java.lang.Class<? extends org.openqa.selenium.WebDriver> driverClass, java.lang.String options, EnvironmentVariables environmentVariables)
void
releaseTimoutFor(org.openqa.selenium.WebDriver driverInstance)
java.time.Duration
resetTimeouts(org.openqa.selenium.WebDriver proxiedDriver)
void
setTimeouts(org.openqa.selenium.WebDriver proxiedDriver, java.time.Duration implicitTimeout)
void
setupFixtureServices()
void
shutdownFixtureServices()
boolean
usesSauceLabs()
WebDriverFactory
withEnvironmentVariables(EnvironmentVariables environmentVariables)
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Field Details
-
DEFAULT_DRIVER
public static final java.lang.String DEFAULT_DRIVER- See Also:
- Constant Field Values
-
REMOTE_DRIVER
public static final java.lang.String REMOTE_DRIVER- See Also:
- Constant Field Values
-
-
Constructor Details
-
WebDriverFactory
public WebDriverFactory() -
WebDriverFactory
-
WebDriverFactory
public WebDriverFactory(EnvironmentVariables environmentVariables, FixtureProviderService fixtureProviderService) -
WebDriverFactory
public WebDriverFactory(EnvironmentVariables environmentVariables, FixtureProviderService fixtureProviderService, SaucelabsRemoteDriverCapabilities saucelabsRemoteDriverCapabilities, TimeoutStack timeoutStack, CloseBrowser closeBrowser)
-
-
Method Details
-
withEnvironmentVariables
-
newInstanceOf
Create a new WebDriver instance of a given type. -
getClassFor
public java.lang.Class<? extends org.openqa.selenium.WebDriver> getClassFor(SupportedWebDriver driverType) -
usesSauceLabs
public boolean usesSauceLabs() -
newWebdriverInstance
protected org.openqa.selenium.WebDriver newWebdriverInstance(java.lang.Class<? extends org.openqa.selenium.WebDriver> driverClass)This method is synchronized because multiple webdriver instances can be created in parallel. However, they may use common system resources such as ports, so may potentially interfere with each other. -
newWebdriverInstance
protected org.openqa.selenium.WebDriver newWebdriverInstance(java.lang.Class<? extends org.openqa.selenium.WebDriver> driverClass, java.lang.String options, EnvironmentVariables environmentVariables) -
getDriverFrom
public static java.lang.String getDriverFrom(EnvironmentVariables environmentVariables, java.lang.String defaultDriver) -
getDriverFrom
-
getBrowserStackDriverFrom
public static java.lang.String getBrowserStackDriverFrom(EnvironmentVariables environmentVariables) -
getSaucelabsDriverFrom
-
setupFixtureServices
- Throws:
FixtureException
-
shutdownFixtureServices
public void shutdownFixtureServices() -
setTimeouts
public void setTimeouts(org.openqa.selenium.WebDriver proxiedDriver, java.time.Duration implicitTimeout) -
currentTimeoutFor
public java.time.Duration currentTimeoutFor(org.openqa.selenium.WebDriver proxiedDriver) -
resetTimeouts
public java.time.Duration resetTimeouts(org.openqa.selenium.WebDriver proxiedDriver) -
getDefaultImplicitTimeout
public java.time.Duration getDefaultImplicitTimeout() -
isAlive
public static boolean isAlive(org.openqa.selenium.WebDriver driver) -
isNotAlive
public static boolean isNotAlive(org.openqa.selenium.WebDriver driver) -
releaseTimoutFor
public void releaseTimoutFor(org.openqa.selenium.WebDriver driverInstance)
-