Class WebConnectionHtmlUnitDriver
java.lang.Object
org.openqa.selenium.htmlunit.HtmlUnitDriver
org.springframework.test.web.servlet.htmlunit.webdriver.WebConnectionHtmlUnitDriver
- All Implemented Interfaces:
org.openqa.selenium.HasCapabilities
,org.openqa.selenium.interactions.Interactive
,org.openqa.selenium.JavascriptExecutor
,org.openqa.selenium.SearchContext
,org.openqa.selenium.WebDriver
public class WebConnectionHtmlUnitDriver
extends org.openqa.selenium.htmlunit.HtmlUnitDriver
WebConnectionHtmlUnitDriver
enables configuration of the
WebConnection
for an HtmlUnitDriver
instance.
This is useful because it allows a
MockMvcWebConnection
to be injected.
- Since:
- 4.2
- Author:
- Rob Winch, Sam Brannen, Juergen Hoeller
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.openqa.selenium.htmlunit.HtmlUnitDriver
org.openqa.selenium.htmlunit.HtmlUnitDriver.ElementsMap, org.openqa.selenium.htmlunit.HtmlUnitDriver.HtmlUnitWebDriverOptions, org.openqa.selenium.htmlunit.HtmlUnitDriver.JavaScriptResultsCollection
Nested classes/interfaces inherited from interface org.openqa.selenium.WebDriver
org.openqa.selenium.WebDriver.Navigation, org.openqa.selenium.WebDriver.Options, org.openqa.selenium.WebDriver.TargetLocator, org.openqa.selenium.WebDriver.Timeouts, org.openqa.selenium.WebDriver.Window
-
Field Summary
Fields inherited from class org.openqa.selenium.htmlunit.HtmlUnitDriver
BROWSER_LANGUAGE_CAPABILITY, DOWNLOAD_IMAGES_CAPABILITY, JAVASCRIPT_ENABLED
-
Constructor Summary
ConstructorDescriptionWebConnectionHtmlUnitDriver
(boolean enableJavascript) WebConnectionHtmlUnitDriver
(org.htmlunit.BrowserVersion browserVersion) WebConnectionHtmlUnitDriver
(org.openqa.selenium.Capabilities capabilities) -
Method Summary
Modifier and TypeMethodDescriptionorg.htmlunit.WebClient
Return the currentWebClient
in a public fashion.org.htmlunit.WebConnection
Access the currentWebConnection
for theWebClient
.protected final org.htmlunit.WebClient
modifyWebClient
(org.htmlunit.WebClient webClient) Modify the suppliedWebClient
and retain a reference to it so that itsWebConnection
is accessible for later use.protected org.htmlunit.WebClient
modifyWebClientInternal
(org.htmlunit.WebClient webClient) Modify the suppliedWebClient
.void
setWebConnection
(org.htmlunit.WebConnection webConnection) Set theWebConnection
to be used with theWebClient
.Methods inherited from class org.openqa.selenium.htmlunit.HtmlUnitDriver
assertElementNotStale, click, close, doubleClick, executeAsyncScript, executeScript, findElement, findElement, findElements, findElements, get, get, getAlert, getBrowserVersion, getCapabilities, getCurrentUrl, getCurrentWindow, getElementsMap, getKeyboard, getMouse, getPageSource, getTitle, getWindowHandle, getWindowHandles, implicitlyWaitFor, isAcceptInsecureCerts, isDownloadImages, isJavascriptEnabled, manage, mouseDown, mouseMove, mouseUp, navigate, newWebClient, openNewWindow, perform, quit, resetInputState, runAsync, sendKeys, setAcceptInsecureCerts, setAutoProxy, setCurrentWindow, setDownloadImages, setExecutor, setHTTPProxy, setJavascriptEnabled, setProxy, setProxySettings, setSocksProxy, setSocksProxy, submit, switchTo, switchToDefaultContentOfWindow, toWebElement, toWebElement
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.openqa.selenium.JavascriptExecutor
executeScript, getPinnedScripts, pin, unpin
-
Constructor Details
-
WebConnectionHtmlUnitDriver
public WebConnectionHtmlUnitDriver() -
WebConnectionHtmlUnitDriver
public WebConnectionHtmlUnitDriver(org.htmlunit.BrowserVersion browserVersion) -
WebConnectionHtmlUnitDriver
public WebConnectionHtmlUnitDriver(boolean enableJavascript) -
WebConnectionHtmlUnitDriver
public WebConnectionHtmlUnitDriver(org.openqa.selenium.Capabilities capabilities)
-
-
Method Details
-
modifyWebClient
protected final org.htmlunit.WebClient modifyWebClient(org.htmlunit.WebClient webClient) Modify the suppliedWebClient
and retain a reference to it so that itsWebConnection
is accessible for later use.Delegates to
HtmlUnitDriver.modifyWebClient(org.htmlunit.WebClient)
for default behavior and tomodifyWebClientInternal(org.htmlunit.WebClient)
for further customization.- Overrides:
modifyWebClient
in classorg.openqa.selenium.htmlunit.HtmlUnitDriver
- Parameters:
webClient
- the client to modify- Returns:
- the modified client
- See Also:
-
HtmlUnitDriver.modifyWebClient(WebClient)
modifyWebClientInternal(WebClient)
-
modifyWebClientInternal
protected org.htmlunit.WebClient modifyWebClientInternal(org.htmlunit.WebClient webClient) Modify the suppliedWebClient
.The default implementation simply returns the supplied client unmodified.
Subclasses can override this method to customize the
WebClient
that theHtmlUnitDriver
uses.- Parameters:
webClient
- the client to modify- Returns:
- the modified client
-
getWebClient
public org.htmlunit.WebClient getWebClient()Return the currentWebClient
in a public fashion.- Overrides:
getWebClient
in classorg.openqa.selenium.htmlunit.HtmlUnitDriver
- Since:
- 4.3
-
setWebConnection
public void setWebConnection(org.htmlunit.WebConnection webConnection) Set theWebConnection
to be used with theWebClient
.- Parameters:
webConnection
- theWebConnection
to use
-
getWebConnection
public org.htmlunit.WebConnection getWebConnection()Access the currentWebConnection
for theWebClient
.- Returns:
- the current
WebConnection
-