org.openqa.selenium.android.library
Class AndroidWebDriver
java.lang.Object
org.openqa.selenium.android.library.AndroidWebDriver
- All Implemented Interfaces:
- android.location.LocationListener, HasTouchScreen, ApplicationCache, BrowserConnection, LocationContext, WebStorage, JavascriptExecutor, Rotatable, SearchContext, TakesScreenshot, WebDriver
public class AndroidWebDriver
- extends java.lang.Object
- implements WebDriver, SearchContext, JavascriptExecutor, TakesScreenshot, Rotatable, BrowserConnection, HasTouchScreen, WebStorage, LocationContext, android.location.LocationListener, ApplicationCache
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
AndroidWebDriver
public AndroidWebDriver(android.app.Activity activity)
- Use this contructor to use WebDriver with a WebView that has the same settings as
the Android browser.
- Parameters:
activity - the activity context where the WebView will be created.
AndroidWebDriver
public AndroidWebDriver(android.app.Activity activity,
ViewFactory viewFactory,
ViewClientWrapper viewClient,
ChromeClientWrapper chromeClient)
- Use this constructor to use WebDriver with a custom view.
- Parameters:
activity - the activity context where the view will be displayed.viewFactory - a implementation of the ViewFactory interface. WebDriver will
use this creation mechanism to create views when needed (e.g. when clicking on a link
that opens a new window).viewClient - the ViewClientWrapper used by the custom WebView.chromeClient - the ChromeClientWrapper used by the custom WebView.
AndroidWebDriver
public AndroidWebDriver(android.app.Activity activity,
ViewFactory viewFactory,
ViewClientWrapper viewClient,
ChromeClientWrapper chromeClient,
android.view.View.OnFocusChangeListener focusListener)
- Use this constructor to use WebDriver with a custom view and a custom
View.OnFocusChangeListener for that view..
- Parameters:
activity - the activity context where the view will be displayed.viewFactory - a implementation of the ViewFactory interface. WebDriver will
use this creation mechanism to create views when needed (e.g. when clicking on a link
that opens a new window).viewClient - the ViewClientWrapper used by the custom WebView.chromeClient - the ChromeClientWrapper used by the custom WebView.focusListener - the listener used by the view that will be created by the viewFactory.
setAcceptSslCerts
public void setAcceptSslCerts(boolean accept)
getAcceptSslCerts
public boolean getAcceptSslCerts()
getWebView
public android.webkit.WebView getWebView()
getView
public java.lang.Object getView()
getActivity
public android.app.Activity getActivity()
getCurrentUrl
public java.lang.String getCurrentUrl()
- Specified by:
getCurrentUrl in interface WebDriver
getTitle
public java.lang.String getTitle()
- Specified by:
getTitle in interface WebDriver
get
public void get(java.lang.String url)
- Specified by:
get in interface WebDriver
getPageSource
public java.lang.String getPageSource()
- Specified by:
getPageSource in interface WebDriver
close
public void close()
- Specified by:
close in interface WebDriver
quit
public void quit()
- Specified by:
quit in interface WebDriver
findElement
public WebElement findElement(By by)
- Specified by:
findElement in interface SearchContext- Specified by:
findElement in interface WebDriver
findElements
public java.util.List<WebElement> findElements(By by)
- Specified by:
findElements in interface SearchContext- Specified by:
findElements in interface WebDriver
getStatus
public AppCacheStatus getStatus()
- Specified by:
getStatus in interface ApplicationCache
getWindowHandles
public java.util.Set<java.lang.String> getWindowHandles()
- Specified by:
getWindowHandles in interface WebDriver
getWindowHandle
public java.lang.String getWindowHandle()
- Specified by:
getWindowHandle in interface WebDriver
switchTo
public WebDriver.TargetLocator switchTo()
- Specified by:
switchTo in interface WebDriver
getLocalStorage
public LocalStorage getLocalStorage()
- Specified by:
getLocalStorage in interface WebStorage
getSessionStorage
public SessionStorage getSessionStorage()
- Specified by:
getSessionStorage in interface WebStorage
navigate
public WebDriver.Navigation navigate()
- Specified by:
navigate in interface WebDriver
isJavascriptEnabled
public boolean isJavascriptEnabled()
executeScript
public java.lang.Object executeScript(java.lang.String script,
java.lang.Object... args)
- Specified by:
executeScript in interface JavascriptExecutor
executeAsyncScript
public java.lang.Object executeAsyncScript(java.lang.String script,
java.lang.Object... args)
- Specified by:
executeAsyncScript in interface JavascriptExecutor
processJsonObject
protected java.lang.Object processJsonObject(java.lang.Object res)
throws org.json.JSONException
- Throws:
org.json.JSONException
setProxy
public void setProxy(java.lang.String host,
int port)
manage
public WebDriver.Options manage()
- Specified by:
manage in interface WebDriver
location
public Location location()
- Specified by:
location in interface LocationContext
setLocation
public void setLocation(Location loc)
- Specified by:
setLocation in interface LocationContext
onLocationChanged
public void onLocationChanged(android.location.Location location)
- Specified by:
onLocationChanged in interface android.location.LocationListener
onStatusChanged
public void onStatusChanged(java.lang.String s,
int i,
android.os.Bundle bundle)
- Specified by:
onStatusChanged in interface android.location.LocationListener
onProviderEnabled
public void onProviderEnabled(java.lang.String s)
- Specified by:
onProviderEnabled in interface android.location.LocationListener
onProviderDisabled
public void onProviderDisabled(java.lang.String s)
- Specified by:
onProviderDisabled in interface android.location.LocationListener
getScreenshotAs
public <X> X getScreenshotAs(OutputType<X> target)
throws WebDriverException
- Specified by:
getScreenshotAs in interface TakesScreenshot
- Throws:
WebDriverException
getOrientation
public ScreenOrientation getOrientation()
- Specified by:
getOrientation in interface Rotatable
rotate
public void rotate(ScreenOrientation orientation)
- Specified by:
rotate in interface Rotatable
isOnline
public boolean isOnline()
- Specified by:
isOnline in interface BrowserConnection
setOnline
public void setOnline(boolean online)
throws WebDriverException
- Specified by:
setOnline in interface BrowserConnection
- Throws:
WebDriverException
getTouch
public TouchScreen getTouch()
- Specified by:
getTouch in interface HasTouchScreen
Copyright © 2012. All Rights Reserved.