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 noWebDriveris currently active, a new instance will be created. - If aWebDriveris currently active and itsCapabilitiesmatch the given desired ones, the currently active instance will be returned. - If aWebDriveris currently active and itsCapabilitiesDO NOT match the given desired ones, the currently active instance will be closed and a new one will be created.
getWebDriver in interface WebDriverManagercapabilities - The desired CapabilitiesWebDriver instancepublic void quitWebDriver(org.openqa.selenium.WebDriver webDriver)
WebDriver instance.quitWebDriver in interface WebDriverManagerwebDriver - The WebDriver instance to quitIllegalArgumentException - When the given instance is not managed by this classpublic void shutdown()
WebDriverManagerWebDriver instances managed by this class.shutdown in interface WebDriverManagerquitWebDriver(WebDriver)public Optional<org.openqa.selenium.WebDriver> getCurrentWebDriver()
public Optional<org.openqa.selenium.Capabilities> getCurrentCapabilities()
Copyright © 2019. All rights reserved.