public class HtmlUnitDriver extends Object implements org.openqa.selenium.WebDriver, org.openqa.selenium.JavascriptExecutor, org.openqa.selenium.internal.FindsById, org.openqa.selenium.internal.FindsByLinkText, org.openqa.selenium.internal.FindsByXPath, org.openqa.selenium.internal.FindsByName, org.openqa.selenium.internal.FindsByCssSelector, org.openqa.selenium.internal.FindsByTagName, org.openqa.selenium.HasCapabilities, org.openqa.selenium.HasInputDevices
Modifier and Type | Class and Description |
---|---|
class |
HtmlUnitDriver.HtmlUnitWindow |
protected static interface |
HtmlUnitDriver.JavaScriptResultsCollection |
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
Modifier and Type | Field and Description |
---|---|
static String |
INVALIDSELECTIONERROR |
static String |
INVALIDXPATHERROR |
Constructor and Description |
---|
HtmlUnitDriver() |
HtmlUnitDriver(boolean enableJavascript) |
HtmlUnitDriver(com.gargoylesoftware.htmlunit.BrowserVersion version) |
HtmlUnitDriver(org.openqa.selenium.Capabilities capabilities)
Note: There are two configuration modes for the HtmlUnitDriver using this constructor.
|
Modifier and Type | Method and Description |
---|---|
protected void |
assertElementNotStale(com.gargoylesoftware.htmlunit.html.HtmlElement element) |
void |
close() |
Object |
executeAsyncScript(String script,
Object... args) |
Object |
executeScript(String script,
Object... args) |
org.openqa.selenium.WebElement |
findElement(org.openqa.selenium.By by) |
org.openqa.selenium.WebElement |
findElementByCssSelector(String using) |
org.openqa.selenium.WebElement |
findElementById(String id) |
org.openqa.selenium.WebElement |
findElementByLinkText(String selector) |
org.openqa.selenium.WebElement |
findElementByName(String name) |
org.openqa.selenium.WebElement |
findElementByPartialLinkText(String using) |
org.openqa.selenium.WebElement |
findElementByTagName(String name) |
org.openqa.selenium.WebElement |
findElementByXPath(String selector) |
List<org.openqa.selenium.WebElement> |
findElements(org.openqa.selenium.By by) |
List<org.openqa.selenium.WebElement> |
findElementsByCssSelector(String using) |
List<org.openqa.selenium.WebElement> |
findElementsById(String id) |
List<org.openqa.selenium.WebElement> |
findElementsByLinkText(String selector) |
List<org.openqa.selenium.WebElement> |
findElementsByName(String using) |
List<org.openqa.selenium.WebElement> |
findElementsByPartialLinkText(String using) |
List<org.openqa.selenium.WebElement> |
findElementsByTagName(String using) |
List<org.openqa.selenium.WebElement> |
findElementsByXPath(String selector) |
void |
get(String url) |
protected void |
get(URL fullUrl)
Allows HtmlUnit's about:blank to be loaded in the constructor, and may be useful for other
tests?
|
org.openqa.selenium.Capabilities |
getCapabilities() |
String |
getCurrentUrl() |
protected com.gargoylesoftware.htmlunit.WebWindow |
getCurrentWindow() |
org.openqa.selenium.Keyboard |
getKeyboard() |
org.openqa.selenium.Mouse |
getMouse() |
String |
getPageSource() |
String |
getTitle() |
protected com.gargoylesoftware.htmlunit.WebClient |
getWebClient() |
String |
getWindowHandle() |
Set<String> |
getWindowHandles() |
protected <X> X |
implicitlyWaitFor(Callable<X> condition) |
boolean |
isJavascriptEnabled() |
protected com.gargoylesoftware.htmlunit.Page |
lastPage() |
org.openqa.selenium.WebDriver.Options |
manage() |
protected com.gargoylesoftware.htmlunit.WebClient |
modifyWebClient(com.gargoylesoftware.htmlunit.WebClient client)
Child classes can override this method to customise the webclient that the HtmlUnit driver
uses.
|
org.openqa.selenium.WebDriver.Navigation |
navigate() |
protected org.openqa.selenium.WebElement |
newHtmlUnitWebElement(com.gargoylesoftware.htmlunit.html.HtmlElement element) |
protected com.gargoylesoftware.htmlunit.WebClient |
newWebClient(com.gargoylesoftware.htmlunit.BrowserVersion version)
Create the underlying webclient, but don't set any fields on it.
|
protected void |
pickWindow() |
void |
quit() |
void |
setAutoProxy(String autoProxyUrl) |
void |
setJavascriptEnabled(boolean enableJavascript) |
void |
setProxy(String host,
int port) |
org.openqa.selenium.WebDriver.TargetLocator |
switchTo() |
public static final String INVALIDXPATHERROR
public static final String INVALIDSELECTIONERROR
public HtmlUnitDriver(com.gargoylesoftware.htmlunit.BrowserVersion version)
public HtmlUnitDriver()
public HtmlUnitDriver(boolean enableJavascript)
public HtmlUnitDriver(org.openqa.selenium.Capabilities capabilities)
protected com.gargoylesoftware.htmlunit.WebClient newWebClient(com.gargoylesoftware.htmlunit.BrowserVersion version)
version
- Which browser to emulateprotected com.gargoylesoftware.htmlunit.WebClient modifyWebClient(com.gargoylesoftware.htmlunit.WebClient client)
client
- The client to modifypublic void setProxy(String host, int port)
public void setAutoProxy(String autoProxyUrl)
public org.openqa.selenium.Capabilities getCapabilities()
getCapabilities
in interface org.openqa.selenium.HasCapabilities
public void get(String url)
get
in interface org.openqa.selenium.WebDriver
protected void get(URL fullUrl)
fullUrl
- The URL to visitprotected void pickWindow()
public String getCurrentUrl()
getCurrentUrl
in interface org.openqa.selenium.WebDriver
public String getTitle()
getTitle
in interface org.openqa.selenium.WebDriver
public org.openqa.selenium.WebElement findElement(org.openqa.selenium.By by)
findElement
in interface org.openqa.selenium.SearchContext
findElement
in interface org.openqa.selenium.WebDriver
public List<org.openqa.selenium.WebElement> findElements(org.openqa.selenium.By by)
findElements
in interface org.openqa.selenium.SearchContext
findElements
in interface org.openqa.selenium.WebDriver
public String getPageSource()
getPageSource
in interface org.openqa.selenium.WebDriver
public void close()
close
in interface org.openqa.selenium.WebDriver
public void quit()
quit
in interface org.openqa.selenium.WebDriver
public Set<String> getWindowHandles()
getWindowHandles
in interface org.openqa.selenium.WebDriver
public String getWindowHandle()
getWindowHandle
in interface org.openqa.selenium.WebDriver
public Object executeScript(String script, Object... args)
executeScript
in interface org.openqa.selenium.JavascriptExecutor
public Object executeAsyncScript(String script, Object... args)
executeAsyncScript
in interface org.openqa.selenium.JavascriptExecutor
protected void assertElementNotStale(com.gargoylesoftware.htmlunit.html.HtmlElement element)
public org.openqa.selenium.Keyboard getKeyboard()
getKeyboard
in interface org.openqa.selenium.HasInputDevices
public org.openqa.selenium.Mouse getMouse()
getMouse
in interface org.openqa.selenium.HasInputDevices
public org.openqa.selenium.WebDriver.TargetLocator switchTo()
switchTo
in interface org.openqa.selenium.WebDriver
public org.openqa.selenium.WebDriver.Navigation navigate()
navigate
in interface org.openqa.selenium.WebDriver
protected com.gargoylesoftware.htmlunit.Page lastPage()
public org.openqa.selenium.WebElement findElementByLinkText(String selector)
findElementByLinkText
in interface org.openqa.selenium.internal.FindsByLinkText
protected org.openqa.selenium.WebElement newHtmlUnitWebElement(com.gargoylesoftware.htmlunit.html.HtmlElement element)
public List<org.openqa.selenium.WebElement> findElementsByLinkText(String selector)
findElementsByLinkText
in interface org.openqa.selenium.internal.FindsByLinkText
public org.openqa.selenium.WebElement findElementById(String id)
findElementById
in interface org.openqa.selenium.internal.FindsById
public List<org.openqa.selenium.WebElement> findElementsById(String id)
findElementsById
in interface org.openqa.selenium.internal.FindsById
public org.openqa.selenium.WebElement findElementByCssSelector(String using)
findElementByCssSelector
in interface org.openqa.selenium.internal.FindsByCssSelector
public List<org.openqa.selenium.WebElement> findElementsByCssSelector(String using)
findElementsByCssSelector
in interface org.openqa.selenium.internal.FindsByCssSelector
public org.openqa.selenium.WebElement findElementByName(String name)
findElementByName
in interface org.openqa.selenium.internal.FindsByName
public List<org.openqa.selenium.WebElement> findElementsByName(String using)
findElementsByName
in interface org.openqa.selenium.internal.FindsByName
public org.openqa.selenium.WebElement findElementByTagName(String name)
findElementByTagName
in interface org.openqa.selenium.internal.FindsByTagName
public List<org.openqa.selenium.WebElement> findElementsByTagName(String using)
findElementsByTagName
in interface org.openqa.selenium.internal.FindsByTagName
public org.openqa.selenium.WebElement findElementByXPath(String selector)
findElementByXPath
in interface org.openqa.selenium.internal.FindsByXPath
public List<org.openqa.selenium.WebElement> findElementsByXPath(String selector)
findElementsByXPath
in interface org.openqa.selenium.internal.FindsByXPath
public boolean isJavascriptEnabled()
public void setJavascriptEnabled(boolean enableJavascript)
protected <X> X implicitlyWaitFor(Callable<X> condition)
protected com.gargoylesoftware.htmlunit.WebClient getWebClient()
protected com.gargoylesoftware.htmlunit.WebWindow getCurrentWindow()
public org.openqa.selenium.WebDriver.Options manage()
manage
in interface org.openqa.selenium.WebDriver
public org.openqa.selenium.WebElement findElementByPartialLinkText(String using)
findElementByPartialLinkText
in interface org.openqa.selenium.internal.FindsByLinkText
Copyright © 2013. All Rights Reserved.