public class Browser extends Object
Modifier and Type | Field and Description |
---|---|
Document |
doc |
org.openqa.selenium.WebDriver |
webDriver |
Constructor and Description |
---|
Browser(org.openqa.selenium.WebDriver webDriver)
Constructs a new UserAgent instance to wrap the specified webDriver object.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Terminates this browser widow, but does not affect other browser windows that were spawned from this browser instance.
|
void |
download(String url,
File outputFile)
Downloads and saves the content at the specified url to the specified File, overwriting the file if it already exists; this method does not invoke the parser, and therefore UserAgent.doc is not updated; Http/https requests include session/cookie headers.
|
String |
getLocation()
Returns the current URL.
|
String |
getSource() |
String |
getWindowHandle() |
Set<String> |
getWindowHandles() |
Document |
open(File file)
Opens the specified HTML File and creates UserAgent.doc to represent the Document (which is also returned by this method).
|
Document |
openContent(String html)
Opens the specified HTML content using the utf-8 charset and returns a Document object to represent the content.
|
Document |
openContent(String contentType,
String charset,
String content)
Opens the specified HTML content using the utf-8 charset and returns a Document object to represent the content.
|
void |
quit()
Terminates the browser and disposes of all its resources, including other windows that were associated with this browser instance.
|
Document |
visit(String url)
Directs the UserAgent to visit the specified url; UserAgent.doc is created to represent the retrieved HTML Document (which is also returned by this method).
|
Element |
wrap(org.openqa.selenium.WebElement we)
Creates and returns a new Element instance by wrapping the specified WebElement.
|
public org.openqa.selenium.WebDriver webDriver
public Document doc
public Browser(org.openqa.selenium.WebDriver webDriver)
webDriver
- a Selenium webDriver instance that supports Javascript execution.public void quit()
public void close()
public Document visit(String url)
public Document open(File file)
public Element wrap(org.openqa.selenium.WebElement we)
public Document openContent(String html)
public String getLocation()
WebDriver.getCurrentUrl()
public String getSource()
WebDriver.getPageSource()
public String getWindowHandle()
WebDriver.getWindowHandle()
public Document openContent(String contentType, String charset, String content)
public void download(String url, File outputFile) throws JauntiumException
url
- the url (beginning with http://, https://, or ftp://) of the file to download.JauntiumException