Package com.codeborne.selenide
Class WebDriverThreadLocalContainer
java.lang.Object
com.codeborne.selenide.WebDriverThreadLocalContainer
- All Implemented Interfaces:
WebDriverContainer
@ParametersAreNonnullByDefault
public class WebDriverThreadLocalContainer
extends Object
implements WebDriverContainer
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addListener
(org.openqa.selenium.support.events.WebDriverListener listener) void
void
Remove links to webdriver/proxy AND close the webdriver and proxyvoid
org.openqa.selenium.WebDriver
org.openqa.selenium.WebDriver
boolean
void
inNewBrowser
(Runnable lambda) void
removeListener
(org.openqa.selenium.support.events.WebDriverListener listener) void
setProxy
(org.openqa.selenium.Proxy userProvidedProxy) void
setWebDriver
(org.openqa.selenium.WebDriver webDriver) void
setWebDriver
(org.openqa.selenium.WebDriver webDriver, SelenideProxyServer selenideProxy) void
setWebDriver
(org.openqa.selenium.WebDriver webDriver, SelenideProxyServer selenideProxy, DownloadsFolder browserDownloadsFolder) Make Selenide use given webdriver [and proxy] in the current thread.void
using
(org.openqa.selenium.WebDriver driver, SelenideProxyServer proxy, DownloadsFolder downloadsFolder, Runnable lambda)
-
Constructor Details
-
WebDriverThreadLocalContainer
public WebDriverThreadLocalContainer()
-
-
Method Details
-
addListener
public void addListener(org.openqa.selenium.support.events.WebDriverListener listener) - Specified by:
addListener
in interfaceWebDriverContainer
-
removeListener
public void removeListener(org.openqa.selenium.support.events.WebDriverListener listener) - Specified by:
removeListener
in interfaceWebDriverContainer
-
setWebDriver
public void setWebDriver(org.openqa.selenium.WebDriver webDriver) - Specified by:
setWebDriver
in interfaceWebDriverContainer
-
setWebDriver
public void setWebDriver(org.openqa.selenium.WebDriver webDriver, @Nullable SelenideProxyServer selenideProxy) - Specified by:
setWebDriver
in interfaceWebDriverContainer
-
setWebDriver
public void setWebDriver(org.openqa.selenium.WebDriver webDriver, @Nullable SelenideProxyServer selenideProxy, DownloadsFolder browserDownloadsFolder) Make Selenide use given webdriver [and proxy] in the current thread. NB! This method is meant to be called BEFORE performing any actions with web elements. It does NOT close a previously opened webdriver/proxy.- Specified by:
setWebDriver
in interfaceWebDriverContainer
- Parameters:
webDriver
- any webdriver created by userselenideProxy
- any proxy created by user (or null if proxy is not needed)browserDownloadsFolder
- downloads folder - unique for the given browser instance
-
setProxy
public void setProxy(@Nullable org.openqa.selenium.Proxy userProvidedProxy) - Specified by:
setProxy
in interfaceWebDriverContainer
-
hasWebDriverStarted
@CheckReturnValue public boolean hasWebDriverStarted()- Specified by:
hasWebDriverStarted
in interfaceWebDriverContainer
- Returns:
- true iff webdriver is started in current thread
-
getWebDriver
@CheckReturnValue @Nonnull public org.openqa.selenium.WebDriver getWebDriver()- Specified by:
getWebDriver
in interfaceWebDriverContainer
-
getAndCheckWebDriver
@CheckReturnValue @Nonnull public org.openqa.selenium.WebDriver getAndCheckWebDriver()- Specified by:
getAndCheckWebDriver
in interfaceWebDriverContainer
-
getBrowserDownloadsFolder
- Specified by:
getBrowserDownloadsFolder
in interfaceWebDriverContainer
-
getProxyServer
- Specified by:
getProxyServer
in interfaceWebDriverContainer
-
closeWindow
public void closeWindow()- Specified by:
closeWindow
in interfaceWebDriverContainer
-
closeWebDriver
public void closeWebDriver()Remove links to webdriver/proxy AND close the webdriver and proxy- Specified by:
closeWebDriver
in interfaceWebDriverContainer
-
using
public void using(org.openqa.selenium.WebDriver driver, @Nullable SelenideProxyServer proxy, @Nullable DownloadsFolder downloadsFolder, Runnable lambda) - Specified by:
using
in interfaceWebDriverContainer
-
inNewBrowser
- Specified by:
inNewBrowser
in interfaceWebDriverContainer
-
clearBrowserCache
public void clearBrowserCache()- Specified by:
clearBrowserCache
in interfaceWebDriverContainer
-
getPageSource
- Specified by:
getPageSource
in interfaceWebDriverContainer
-
getCurrentUrl
- Specified by:
getCurrentUrl
in interfaceWebDriverContainer
-
getCurrentFrameUrl
- Specified by:
getCurrentFrameUrl
in interfaceWebDriverContainer
-