|
spring-test-mvc-htmlunit | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.openqa.selenium.htmlunit.HtmlUnitDriver
org.springframework.test.web.servlet.htmlunit.webdriver.MockMvcHtmlUnitDriver
public final class MockMvcHtmlUnitDriver
Allows running tests off line by utilizing Spring's MockMvc
to bridge between a request and a response. By
doing this we are able to avoid making any HTTP calls when our tests are running. This implies we do not need to
start a web container to run our tests.
Example usage can be seen below:
WebApplicationContext context = ... MockHtmlUnitDriver driver = new MockHtmlUnitDriver(context, true); ... use driver as you would HtmlUnitDriver ...
MockMvc mockMvc = ... MockHtmlUnitDriver driver = new MockHtmlUnitDriver(mockMvc, true); ... use driver as you would HtmlUnitDriver ...
The only reason for this class is in order to customize the WebConnection
used by HtmlUnitDriver
. We
cannot use a simple bean methods since there are no accessor methods for WebClient
or the WebClient
's
underlying WebConnection
. The only means to update the WebConnection
is to override the
modifyWebClient(WebClient)
method. Hence for the existence of this class.
MockMvc
,
MockMvcWebConnection
Nested Class Summary |
---|
Nested classes/interfaces inherited from class org.openqa.selenium.htmlunit.HtmlUnitDriver |
---|
org.openqa.selenium.htmlunit.HtmlUnitDriver.HtmlUnitWindow, org.openqa.selenium.htmlunit.HtmlUnitDriver.JavaScriptResultsCollection |
Nested classes/interfaces inherited from interface org.openqa.selenium.WebDriver |
---|
org.openqa.selenium.WebDriver.ImeHandler, 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 |
---|
INVALIDSELECTIONERROR, INVALIDXPATHERROR |
Constructor Summary | |
---|---|
MockMvcHtmlUnitDriver(org.springframework.test.web.servlet.MockMvc mockMvc)
|
|
MockMvcHtmlUnitDriver(org.springframework.test.web.servlet.MockMvc mockMvc,
boolean enableJavascript)
|
|
MockMvcHtmlUnitDriver(org.springframework.test.web.servlet.MockMvc mockMvc,
com.gargoylesoftware.htmlunit.BrowserVersion version)
|
|
MockMvcHtmlUnitDriver(org.springframework.test.web.servlet.MockMvc mockMvc,
org.openqa.selenium.Capabilities capabilities)
|
|
MockMvcHtmlUnitDriver(org.springframework.web.context.WebApplicationContext webContext)
|
|
MockMvcHtmlUnitDriver(org.springframework.web.context.WebApplicationContext webContext,
boolean enableJavascript)
|
|
MockMvcHtmlUnitDriver(org.springframework.web.context.WebApplicationContext webContext,
com.gargoylesoftware.htmlunit.BrowserVersion version)
|
|
MockMvcHtmlUnitDriver(org.springframework.web.context.WebApplicationContext webContext,
org.openqa.selenium.Capabilities capabilities)
|
Method Summary | |
---|---|
protected com.gargoylesoftware.htmlunit.WebClient |
modifyWebClient(com.gargoylesoftware.htmlunit.WebClient client)
|
Methods inherited from class org.openqa.selenium.htmlunit.HtmlUnitDriver |
---|
assertElementNotStale, close, executeAsyncScript, executeScript, findElement, findElementByClassName, findElementByCssSelector, findElementById, findElementByLinkText, findElementByName, findElementByPartialLinkText, findElementByTagName, findElementByXPath, findElements, findElementsByClassName, findElementsByCssSelector, findElementsById, findElementsByLinkText, findElementsByName, findElementsByPartialLinkText, findElementsByTagName, findElementsByXPath, get, get, getCapabilities, getCurrentUrl, getCurrentWindow, getKeyboard, getMouse, getPageSource, getTitle, getWebClient, getWindowHandle, getWindowHandles, implicitlyWaitFor, isJavascriptEnabled, lastPage, manage, navigate, newHtmlUnitWebElement, newWebClient, pickWindow, quit, setAutoProxy, setHTTPProxy, setJavascriptEnabled, setProxy, setProxySettings, setSocksProxy, setSocksProxy, switchTo |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public MockMvcHtmlUnitDriver(org.springframework.web.context.WebApplicationContext webContext)
public MockMvcHtmlUnitDriver(org.springframework.web.context.WebApplicationContext webContext, boolean enableJavascript)
public MockMvcHtmlUnitDriver(org.springframework.web.context.WebApplicationContext webContext, com.gargoylesoftware.htmlunit.BrowserVersion version)
public MockMvcHtmlUnitDriver(org.springframework.web.context.WebApplicationContext webContext, org.openqa.selenium.Capabilities capabilities)
public MockMvcHtmlUnitDriver(org.springframework.test.web.servlet.MockMvc mockMvc)
public MockMvcHtmlUnitDriver(org.springframework.test.web.servlet.MockMvc mockMvc, boolean enableJavascript)
public MockMvcHtmlUnitDriver(org.springframework.test.web.servlet.MockMvc mockMvc, com.gargoylesoftware.htmlunit.BrowserVersion version)
public MockMvcHtmlUnitDriver(org.springframework.test.web.servlet.MockMvc mockMvc, org.openqa.selenium.Capabilities capabilities)
Method Detail |
---|
protected com.gargoylesoftware.htmlunit.WebClient modifyWebClient(com.gargoylesoftware.htmlunit.WebClient client)
modifyWebClient
in class org.openqa.selenium.htmlunit.HtmlUnitDriver
|
spring-test-mvc-htmlunit | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |