public class WebDriverBrowserImpl extends AbstractWebBrowser<org.openqa.selenium.firefox.FirefoxDriver>
Modifier and Type | Class and Description |
---|---|
static class |
WebDriverBrowserImpl.GeoLocation |
WebBrowser.ContentType, WebBrowser.Options
MiniBrowser.Advice
locationEmpty
Constructor and Description |
---|
WebDriverBrowserImpl(PlatformConfiguration platformConfiguration,
RunConfiguration runOptionsConfiguration,
JavaScriptConfiguration javaScriptConfiguration) |
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()
Forces back button on the browser
|
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
|
WebActionExecutor |
getActionExecutor()
Returns a WebActionExecutor if available for this implementation, or null otherwise
|
AdviceProcessor |
getAdviceProcessor() |
protected org.openqa.selenium.firefox.FirefoxDriver |
getBrowser() |
DOMWindow |
getContentDOMWindow()
Return the top-level dom window associated to this browser
|
WebBrowserBuilder.Engine |
getEngine() |
String |
getLocationURL()
Returns the URL of the resource that the web browser is currently displaying, or null if no navigation to any url
has been performed yet.
|
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)
Navigate to the given URL and waits until the new page is fully loaded (listen to "load" JavaScript event)
|
void |
navigate(String uRI,
boolean waitUntilLoaded)
Navigate to the given URL.
|
void |
navigate(URI uri) |
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 x,
int y)
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.
|
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.
|
getDOMElementByLocator, getURL, navigate, stats
public WebDriverBrowserImpl(PlatformConfiguration platformConfiguration, RunConfiguration runOptionsConfiguration, JavaScriptConfiguration javaScriptConfiguration) throws org.apache.commons.configuration2.ex.ConfigurationException
org.apache.commons.configuration2.ex.ConfigurationException
public WebActionExecutor getActionExecutor()
MiniBrowser
public WebBrowser.Options manageOptions()
WebBrowser
public void setPageLoadingTimeout(long time, TimeUnit unit)
WebBrowser
WebBrowser.navigate(String, boolean)
will throw exceptions.setPageLoadingTimeout
in interface WebBrowser
setPageLoadingTimeout
in class AbstractWebBrowser<org.openqa.selenium.firefox.FirefoxDriver>
public DOMWindow getContentDOMWindow()
public DOMWindow getWindow()
WebBrowser.getContentDOMWindow()
getWindow
in interface WebBrowser
getWindow
in class AbstractWebBrowser<org.openqa.selenium.firefox.FirefoxDriver>
public void setWindowSize(int width, int height)
public void navigate(String uRI)
public int navigateAndStatus(URI uri)
WebBrowser
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)public void navigate(URI uri)
public void navigate(String 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
public String getLocationURL()
public void close()
DOMWindow
calling this
#getContentDOMWindow().close()
close
in interface AutoCloseable
close
in interface WebBrowser
close
in class AbstractWebBrowser<org.openqa.selenium.firefox.FirefoxDriver>
public void back(boolean waitUntilLoaded)
waitUntilLoaded
- if true, it runs synchronously, waiting for the fully loaded pagepublic void back()
MiniBrowser
public void forward(boolean waitUntilLoaded)
waitUntilLoaded
- if true, it runs synchronously, waiting for the fully loaded pagepublic DOMXPathEvaluator getXPathEvaluator()
public void addProgressListener(BrowserProgressListener listener)
public void removeProgressListener(BrowserProgressListener listener)
public void addLocationListener(BrowserLocationListener listener)
public void removeLocationListener(BrowserLocationListener listener)
public void addTitleListener(BrowserTitleListener listener)
public void removeTitleListener(BrowserTitleListener listener)
public void addStatusTextListener(BrowserStatusTextListener listener)
public void removeStatusTextListener(BrowserStatusTextListener listener)
public 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 driverpublic void refresh()
public void stop()
public boolean isBackEnabled()
public boolean isForwardEnabled()
public Object evaluate(String script)
public 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 setpublic void setZoom(int zoomRatio)
public void enableSilentPromptService(boolean b)
enableSilentPromptService
in interface WebBrowser
enableSilentPromptService
in class AbstractWebBrowser<org.openqa.selenium.firefox.FirefoxDriver>
b
- true to enablepublic void addOpenNewWindowListener(OpenNewWindowListener openNewWindowListener)
public void removeOpenNewWindowListener(OpenNewWindowListener listener)
public void shutdown()
WebBrowser.close()
to
close only the current browser instance.public void cleanCache()
public void removeAllCookies()
public boolean executeJavaScript(String script)
public void saveDocument(String name)
WebBrowser
public WebBrowserBuilder.Engine getEngine()
protected org.openqa.selenium.firefox.FirefoxDriver getBrowser()
getBrowser
in class AbstractWebBrowser<org.openqa.selenium.firefox.FirefoxDriver>
public JSUtils js()
js
in interface WebBrowser
js
in class AbstractWebBrowser<org.openqa.selenium.firefox.FirefoxDriver>
public void setWindowPosition(int x, int y)
WebBrowser
public File takeScreenshot()
WebBrowser
takeScreenshot
in interface WebBrowser
takeScreenshot
in class AbstractWebBrowser<org.openqa.selenium.firefox.FirefoxDriver>
public DOMWindow switchToDefaultContent()
WebBrowser
public DOMWindow switchToFrame(DOMElement frameElement)
WebBrowser
public AdviceProcessor getAdviceProcessor()
Copyright © 2020 OXPath Team. All rights reserved.