public interface WebBrowser extends AutoCloseable, MiniBrowser
Modifier and Type | Interface and Description |
---|---|
static class |
WebBrowser.ContentType |
static interface |
WebBrowser.Options |
MiniBrowser.Advice
Modifier and Type | Method and Description |
---|---|
void |
addLocationListener(BrowserLocationListener listener) |
void |
addOpenNewWindowListener(OpenNewWindowListener openNewWindowListener) |
void |
addProgressListener(BrowserProgressListener listener) |
void |
addStatusTextListener(BrowserStatusTextListener listener) |
void |
addTitleListener(BrowserTitleListener listener) |
void |
back(boolean waitUntilLoaded)
Forces back button on the browser
|
void |
cleanCache()
Removes allElements cache entries
|
void |
close()
Closes the browser.
|
void |
enableSilentPromptService(boolean b)
if enabled, blocks allElements javascript alerts and popups.
|
Object |
evaluate(String script)
Returns the result, if any, of executing the specified java script.
|
boolean |
executeJavaScript(String script) |
void |
forward(boolean waitUntilLoaded)
Forces forward button on the browser
|
DOMWindow |
getContentDOMWindow()
Return the top-level dom window associated to this browser
|
WebBrowserBuilder.Engine |
getEngine() |
URL |
getURL()
Returns the same as
MiniBrowser.getLocationURL() but as a URL . |
DOMWindow |
getWindow()
Return the top-level dom window associated to this browser.
|
Object |
getWindowFrame()
INTERNAL API SUBJECT TO CHANGE Return the Window frame used by the underlying browser instantiated.
|
DOMXPathEvaluator |
getXPathEvaluator() |
boolean |
isBackEnabled() |
boolean |
isForwardEnabled() |
JSUtils |
js() |
WebBrowser.Options |
manageOptions()
General option configuration
|
void |
navigate(String uRI,
boolean waitUntilLoaded)
Deprecated.
replaced by
navigate(String, boolean)() |
void |
navigate(URI uri,
boolean waitUntilLoaded)
Deprecated.
|
int |
navigateAndStatus(URI uri)
Uses
MiniBrowser.navigate(URI) to navigates on the page and returns the HTTP status code (which might require another
page fetching in case of BrowserFactory.Engine.WEBDRIVER_FF) |
void |
refresh() |
void |
removeAllCookies()
Removes allElements cookies
|
void |
removeLocationListener(BrowserLocationListener listener) |
void |
removeOpenNewWindowListener(OpenNewWindowListener listener) |
void |
removeProgressListener(BrowserProgressListener listener) |
void |
removeStatusTextListener(BrowserStatusTextListener listener) |
void |
removeTitleListener(BrowserTitleListener listener) |
void |
saveDocument(String name)
For debug only, not rely on it as it can be removed from here.
|
void |
setDialogsService(DialogsService service)
Sets a new DialogsService.
|
void |
setPageLoadingTimeout(long time,
TimeUnit unit)
Set the timeout for page loading.
|
void |
setWindowPosition(int i,
int j)
Sets the position of the browser window.
|
void |
setWindowSize(int width,
int height)
Sets the dimension of the browser window, overriding the default values.
|
void |
setZoom(int zoomRatio)
Set the zoom ratio, currenlty works only on Mozilla
|
void |
shutdown()
Kills the current browser and allElements other instances, closing the application.
|
BrowserStats |
stats() |
void |
stop() |
DOMWindow |
switchToDefaultContent()
http://selenium.googlecode.com/svn/trunk/docs/api/java/org/openqa/selenium/WebDriver.TargetLocator.html Selects
either the first frame on the page, or the main document when a page contains iframes.
|
DOMWindow |
switchToFrame(DOMElement frameElement)
Select a frame using its previously located elements
|
File |
takeScreenshot()
Returns a file (created in the temporary file location as indicated by the browser) with a screenshot of the
current browser window.
|
back, getActionExecutor, getAdviceProcessor, getDOMElementByLocator, getLocationURL, navigate, navigate
WebBrowserBuilder.Engine getEngine()
BrowserStats stats()
DOMWindow getContentDOMWindow()
DOMWindow getWindow()
getContentDOMWindow()
void setWindowSize(int width, int height)
width
- height
- int navigateAndStatus(URI uri)
MiniBrowser.navigate(URI)
to navigates on the page and returns the HTTP status code (which might require another
page fetching in case of BrowserFactory.Engine.WEBDRIVER_FF)uri
- @Deprecated void navigate(String uRI, boolean waitUntilLoaded)
navigate(String, boolean)()
waitUntilLoaded
- if true, it runs synchronously, waiting for the fully loaded page. This is always the case for the browser
WebBrowserBuilder.Engine.WEBDRIVER_FF
uRI
- a
- WebAPITimeoutException if the set timeout is exceeded@Deprecated void navigate(URI uri, boolean waitUntilLoaded)
waitUntilLoaded
- if true, it runs synchronously, waiting for the fully loaded page. This is always the case for the browser
WebBrowserBuilder.Engine.WEBDRIVER_FF
uRI
- a
- WebAPITimeoutException if the set timeout is exceededvoid setPageLoadingTimeout(long time, TimeUnit unit)
navigate(String, boolean)
will throw exceptions.time
- unit
- void close()
DOMWindow
calling this
#getContentDOMWindow().close()
close
in interface AutoCloseable
void back(boolean waitUntilLoaded)
waitUntilLoaded
- if true, it runs synchronously, waiting for the fully loaded pagevoid forward(boolean waitUntilLoaded)
waitUntilLoaded
- if true, it runs synchronously, waiting for the fully loaded pageDOMXPathEvaluator getXPathEvaluator()
void addProgressListener(BrowserProgressListener listener)
void removeProgressListener(BrowserProgressListener listener)
void addLocationListener(BrowserLocationListener listener)
void removeLocationListener(BrowserLocationListener listener)
void addTitleListener(BrowserTitleListener listener)
void removeTitleListener(BrowserTitleListener listener)
void addStatusTextListener(BrowserStatusTextListener listener)
void removeStatusTextListener(BrowserStatusTextListener listener)
Object getWindowFrame()
Engine#SWT_MOZILLA
it returns a Composite
while for Engine#HTMLUNIT
it returns the
com.gargoylesoftware.htmlunit.WebClient
, and for WebDriver returns the underlying drivervoid refresh()
void stop()
boolean isBackEnabled()
boolean isForwardEnabled()
Object evaluate(String script)
script
- void setDialogsService(DialogsService service)
DialogsService
implementation in
which you can specify the required behavior during displaying any browser dialog such as alert, confirmation,
JavaScript error dialog.service
- the service to setvoid setZoom(int zoomRatio)
zoomRatio
- void enableSilentPromptService(boolean b)
b
- true to enablevoid addOpenNewWindowListener(OpenNewWindowListener openNewWindowListener)
openNewWindowListener
- void removeOpenNewWindowListener(OpenNewWindowListener listener)
void shutdown()
close()
to
close only the current browser instance.shutdown
in interface MiniBrowser
void cleanCache()
void removeAllCookies()
boolean executeJavaScript(String script)
void saveDocument(String name)
name
- URL getURL()
MiniBrowser.getLocationURL()
but as a URL
. Returns null
if the URL is not valid.getURL
in interface MiniBrowser
JSUtils js()
void setWindowPosition(int i, int j)
File takeScreenshot()
WebBrowser.Options manageOptions()
DOMWindow switchToDefaultContent()
DOMWindow switchToFrame(DOMElement frameElement)
frameElement
- WebAPIRuntimeException
- If the given element is neither an IFRAME nor a FRAME element.Copyright © 2020 OXPath Team. All rights reserved.