org.openqa.selenium.htmlunit
Class HtmlUnitDriver
java.lang.Object
org.openqa.selenium.htmlunit.HtmlUnitDriver
- All Implemented Interfaces:
- org.openqa.selenium.HasCapabilities, org.openqa.selenium.interactions.HasInputDevices, org.openqa.selenium.internal.FindsByCssSelector, org.openqa.selenium.internal.FindsById, org.openqa.selenium.internal.FindsByLinkText, org.openqa.selenium.internal.FindsByName, org.openqa.selenium.internal.FindsByTagName, org.openqa.selenium.internal.FindsByXPath, org.openqa.selenium.JavascriptExecutor, org.openqa.selenium.SearchContext, org.openqa.selenium.WebDriver
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.interactions.HasInputDevices
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 |
Constructor Summary |
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. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
INVALIDXPATHERROR
public static final String INVALIDXPATHERROR
- See Also:
- Constant Field Values
INVALIDSELECTIONERROR
public static final String INVALIDSELECTIONERROR
- See Also:
- Constant Field Values
HtmlUnitDriver
public HtmlUnitDriver(com.gargoylesoftware.htmlunit.BrowserVersion version)
HtmlUnitDriver
public HtmlUnitDriver()
HtmlUnitDriver
public HtmlUnitDriver(boolean enableJavascript)
HtmlUnitDriver
public HtmlUnitDriver(org.openqa.selenium.Capabilities capabilities)
- Note: There are two configuration modes for the HtmlUnitDriver using this constructor. The
first is where the browserName is "firefox", "internet explorer" and browserVersion denotes the
desired version. The second one is where the browserName is "htmlunit" and the browserVersion
denotes the required browser AND its version. In this mode the browserVersion could either be
"firefox" for Firefox or "internet explorer-7" for IE 7. The Remote WebDriver uses the second
mode - the first mode is deprecated and should not be used.
newWebClient
protected com.gargoylesoftware.htmlunit.WebClient newWebClient(com.gargoylesoftware.htmlunit.BrowserVersion version)
- Create the underlying webclient, but don't set any fields on it.
- Parameters:
version
- Which browser to emulate
- Returns:
- a new instance of WebClient.
modifyWebClient
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.
- Parameters:
client
- The client to modify
- Returns:
- The modified client
setProxy
public void setProxy(String host,
int port)
setAutoProxy
public void setAutoProxy(String autoProxyUrl)
getCapabilities
public org.openqa.selenium.Capabilities getCapabilities()
- Specified by:
getCapabilities
in interface org.openqa.selenium.HasCapabilities
get
public void get(String url)
- Specified by:
get
in interface org.openqa.selenium.WebDriver
get
protected void get(URL fullUrl)
- Allows HtmlUnit's about:blank to be loaded in the constructor, and may be useful for other
tests?
- Parameters:
fullUrl
- The URL to visit
pickWindow
protected void pickWindow()
getCurrentUrl
public String getCurrentUrl()
- Specified by:
getCurrentUrl
in interface org.openqa.selenium.WebDriver
getTitle
public String getTitle()
- Specified by:
getTitle
in interface org.openqa.selenium.WebDriver
findElement
public org.openqa.selenium.WebElement findElement(org.openqa.selenium.By by)
- Specified by:
findElement
in interface org.openqa.selenium.SearchContext
- Specified by:
findElement
in interface org.openqa.selenium.WebDriver
findElements
public List<org.openqa.selenium.WebElement> findElements(org.openqa.selenium.By by)
- Specified by:
findElements
in interface org.openqa.selenium.SearchContext
- Specified by:
findElements
in interface org.openqa.selenium.WebDriver
getPageSource
public String getPageSource()
- Specified by:
getPageSource
in interface org.openqa.selenium.WebDriver
close
public void close()
- Specified by:
close
in interface org.openqa.selenium.WebDriver
quit
public void quit()
- Specified by:
quit
in interface org.openqa.selenium.WebDriver
getWindowHandles
public Set<String> getWindowHandles()
- Specified by:
getWindowHandles
in interface org.openqa.selenium.WebDriver
getWindowHandle
public String getWindowHandle()
- Specified by:
getWindowHandle
in interface org.openqa.selenium.WebDriver
executeScript
public Object executeScript(String script,
Object... args)
- Specified by:
executeScript
in interface org.openqa.selenium.JavascriptExecutor
executeAsyncScript
public Object executeAsyncScript(String script,
Object... args)
- Specified by:
executeAsyncScript
in interface org.openqa.selenium.JavascriptExecutor
assertElementNotStale
protected void assertElementNotStale(com.gargoylesoftware.htmlunit.html.HtmlElement element)
getKeyboard
public org.openqa.selenium.interactions.Keyboard getKeyboard()
- Specified by:
getKeyboard
in interface org.openqa.selenium.interactions.HasInputDevices
getMouse
public org.openqa.selenium.interactions.Mouse getMouse()
- Specified by:
getMouse
in interface org.openqa.selenium.interactions.HasInputDevices
switchTo
public org.openqa.selenium.WebDriver.TargetLocator switchTo()
- Specified by:
switchTo
in interface org.openqa.selenium.WebDriver
navigate
public org.openqa.selenium.WebDriver.Navigation navigate()
- Specified by:
navigate
in interface org.openqa.selenium.WebDriver
lastPage
protected com.gargoylesoftware.htmlunit.Page lastPage()
findElementByLinkText
public org.openqa.selenium.WebElement findElementByLinkText(String selector)
- Specified by:
findElementByLinkText
in interface org.openqa.selenium.internal.FindsByLinkText
newHtmlUnitWebElement
protected org.openqa.selenium.WebElement newHtmlUnitWebElement(com.gargoylesoftware.htmlunit.html.HtmlElement element)
findElementsByLinkText
public List<org.openqa.selenium.WebElement> findElementsByLinkText(String selector)
- Specified by:
findElementsByLinkText
in interface org.openqa.selenium.internal.FindsByLinkText
findElementById
public org.openqa.selenium.WebElement findElementById(String id)
- Specified by:
findElementById
in interface org.openqa.selenium.internal.FindsById
findElementsById
public List<org.openqa.selenium.WebElement> findElementsById(String id)
- Specified by:
findElementsById
in interface org.openqa.selenium.internal.FindsById
findElementByCssSelector
public org.openqa.selenium.WebElement findElementByCssSelector(String using)
- Specified by:
findElementByCssSelector
in interface org.openqa.selenium.internal.FindsByCssSelector
findElementsByCssSelector
public List<org.openqa.selenium.WebElement> findElementsByCssSelector(String using)
- Specified by:
findElementsByCssSelector
in interface org.openqa.selenium.internal.FindsByCssSelector
findElementByName
public org.openqa.selenium.WebElement findElementByName(String name)
- Specified by:
findElementByName
in interface org.openqa.selenium.internal.FindsByName
findElementsByName
public List<org.openqa.selenium.WebElement> findElementsByName(String using)
- Specified by:
findElementsByName
in interface org.openqa.selenium.internal.FindsByName
findElementByTagName
public org.openqa.selenium.WebElement findElementByTagName(String name)
- Specified by:
findElementByTagName
in interface org.openqa.selenium.internal.FindsByTagName
findElementsByTagName
public List<org.openqa.selenium.WebElement> findElementsByTagName(String using)
- Specified by:
findElementsByTagName
in interface org.openqa.selenium.internal.FindsByTagName
findElementByXPath
public org.openqa.selenium.WebElement findElementByXPath(String selector)
- Specified by:
findElementByXPath
in interface org.openqa.selenium.internal.FindsByXPath
findElementsByXPath
public List<org.openqa.selenium.WebElement> findElementsByXPath(String selector)
- Specified by:
findElementsByXPath
in interface org.openqa.selenium.internal.FindsByXPath
isJavascriptEnabled
public boolean isJavascriptEnabled()
setJavascriptEnabled
public void setJavascriptEnabled(boolean enableJavascript)
implicitlyWaitFor
protected <X> X implicitlyWaitFor(Callable<X> condition)
getWebClient
protected com.gargoylesoftware.htmlunit.WebClient getWebClient()
getCurrentWindow
protected com.gargoylesoftware.htmlunit.WebWindow getCurrentWindow()
manage
public org.openqa.selenium.WebDriver.Options manage()
- Specified by:
manage
in interface org.openqa.selenium.WebDriver
findElementByPartialLinkText
public org.openqa.selenium.WebElement findElementByPartialLinkText(String using)
- Specified by:
findElementByPartialLinkText
in interface org.openqa.selenium.internal.FindsByLinkText
findElementsByPartialLinkText
public List<org.openqa.selenium.WebElement> findElementsByPartialLinkText(String using)
- Specified by:
findElementsByPartialLinkText
in interface org.openqa.selenium.internal.FindsByLinkText
Copyright © 2013. All rights reserved.