org.openqa.selenium.android.library
Class AndroidWebDriver

java.lang.Object
  extended by 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


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.openqa.selenium.WebDriver
WebDriver.ImeHandler, WebDriver.Navigation, WebDriver.Options, WebDriver.TargetLocator, WebDriver.Timeouts, WebDriver.Window
 
Constructor Summary
AndroidWebDriver(android.app.Activity activity)
          Use this contructor to use WebDriver with a WebView that has the same settings as the Android browser.
AndroidWebDriver(android.app.Activity activity, ViewFactory viewFactory, ViewClientWrapper viewClient, ChromeClientWrapper chromeClient)
          Use this constructor to use WebDriver with a custom view.
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..
 
Method Summary
 void close()
           
 java.lang.Object executeAsyncScript(java.lang.String script, java.lang.Object... args)
           
 java.lang.Object executeScript(java.lang.String script, java.lang.Object... args)
           
 WebElement findElement(By by)
           
 java.util.List<WebElement> findElements(By by)
           
 void get(java.lang.String url)
           
 boolean getAcceptSslCerts()
           
 android.app.Activity getActivity()
           
 java.lang.String getCurrentUrl()
           
 LocalStorage getLocalStorage()
           
 ScreenOrientation getOrientation()
           
 java.lang.String getPageSource()
           
<X> X
getScreenshotAs(OutputType<X> target)
           
 SessionStorage getSessionStorage()
           
 AppCacheStatus getStatus()
           
 java.lang.String getTitle()
           
 TouchScreen getTouch()
           
 java.lang.Object getView()
           
 android.webkit.WebView getWebView()
           
 java.lang.String getWindowHandle()
           
 java.util.Set<java.lang.String> getWindowHandles()
           
 boolean isJavascriptEnabled()
           
 boolean isOnline()
           
 Location location()
           
 WebDriver.Options manage()
           
 WebDriver.Navigation navigate()
           
 void onLocationChanged(android.location.Location location)
           
 void onProviderDisabled(java.lang.String s)
           
 void onProviderEnabled(java.lang.String s)
           
 void onStatusChanged(java.lang.String s, int i, android.os.Bundle bundle)
           
protected  java.lang.Object processJsonObject(java.lang.Object res)
           
 void quit()
           
 void rotate(ScreenOrientation orientation)
           
 void setAcceptSslCerts(boolean accept)
           
 void setLocation(Location loc)
           
 void setOnline(boolean online)
           
 void setProxy(java.lang.String host, int port)
           
 WebDriver.TargetLocator switchTo()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

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.
Method Detail

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.