public class SingletonWebDriverManager extends Object implements WebDriverManager
WebDriverManager
that manages a single WebDriver
instance.Constructor and Description |
---|
SingletonWebDriverManager(WebDriverFactory webDriverFactory) |
Modifier and Type | Method and Description |
---|---|
Optional<org.openqa.selenium.Capabilities> |
getCurrentCapabilities() |
Optional<org.openqa.selenium.WebDriver> |
getCurrentWebDriver() |
org.openqa.selenium.WebDriver |
getWebDriver(org.openqa.selenium.Capabilities capabilities)
Get a
WebDriver instance for the given desired Capabilities . |
void |
quitWebDriver(org.openqa.selenium.WebDriver webDriver)
Quit the given
WebDriver instance. |
void |
shutdown()
Quit all open
WebDriver instances managed by this class. |
public SingletonWebDriverManager(WebDriverFactory webDriverFactory)
@Nonnull public org.openqa.selenium.WebDriver getWebDriver(org.openqa.selenium.Capabilities capabilities)
WebDriver
instance for the given desired Capabilities
.
- If noWebDriver
is currently active, a new instance will be created. - If aWebDriver
is currently active and itsCapabilities
match the given desired ones, the currently active instance will be returned. - If aWebDriver
is currently active and itsCapabilities
DO NOT match the given desired ones, the currently active instance will be closed and a new one will be created.
getWebDriver
in interface WebDriverManager
capabilities
- The desired Capabilities
WebDriver
instancepublic void quitWebDriver(org.openqa.selenium.WebDriver webDriver)
WebDriver
instance.quitWebDriver
in interface WebDriverManager
webDriver
- The WebDriver
instance to quitIllegalArgumentException
- When the given instance is not managed by this classpublic void shutdown()
WebDriverManager
WebDriver
instances managed by this class.shutdown
in interface WebDriverManager
quitWebDriver(WebDriver)
public Optional<org.openqa.selenium.WebDriver> getCurrentWebDriver()
public Optional<org.openqa.selenium.Capabilities> getCurrentCapabilities()
Copyright © 2019. All rights reserved.