org.openqa.selenium.android.library
Class AndroidWebDriver

java.lang.Object
  extended by org.openqa.selenium.android.library.AndroidWebDriver
All Implemented Interfaces:
android.location.LocationListener, org.openqa.selenium.HasTouchScreen, org.openqa.selenium.html5.ApplicationCache, org.openqa.selenium.html5.BrowserConnection, org.openqa.selenium.html5.LocationContext, org.openqa.selenium.html5.WebStorage, org.openqa.selenium.JavascriptExecutor, org.openqa.selenium.Rotatable, org.openqa.selenium.SearchContext, org.openqa.selenium.TakesScreenshot, org.openqa.selenium.WebDriver

public class AndroidWebDriver
extends Object
implements org.openqa.selenium.WebDriver, org.openqa.selenium.SearchContext, org.openqa.selenium.JavascriptExecutor, org.openqa.selenium.TakesScreenshot, org.openqa.selenium.Rotatable, org.openqa.selenium.html5.BrowserConnection, org.openqa.selenium.HasTouchScreen, org.openqa.selenium.html5.WebStorage, org.openqa.selenium.html5.LocationContext, android.location.LocationListener, org.openqa.selenium.html5.ApplicationCache


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.openqa.selenium.WebDriver
org.openqa.selenium.WebDriver.ImeHandler, org.openqa.selenium.WebDriver.Navigation, org.openqa.selenium.WebDriver.Options, org.openqa.selenium.WebDriver.TargetLocator, org.openqa.selenium.WebDriver.Timeouts, org.openqa.selenium.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()
           
 Object executeAsyncScript(String script, Object... args)
           
 Object executeScript(String script, Object... args)
           
 org.openqa.selenium.WebElement findElement(org.openqa.selenium.By by)
           
 List<org.openqa.selenium.WebElement> findElements(org.openqa.selenium.By by)
           
 void get(String url)
           
 boolean getAcceptSslCerts()
           
 android.app.Activity getActivity()
           
 String getCurrentUrl()
           
 org.openqa.selenium.html5.LocalStorage getLocalStorage()
           
 org.openqa.selenium.ScreenOrientation getOrientation()
           
 String getPageSource()
           
<X> X
getScreenshotAs(org.openqa.selenium.OutputType<X> target)
           
 org.openqa.selenium.html5.SessionStorage getSessionStorage()
           
 org.openqa.selenium.html5.AppCacheStatus getStatus()
           
 String getTitle()
           
 org.openqa.selenium.TouchScreen getTouch()
           
 Object getView()
           
 android.webkit.WebView getWebView()
           
 String getWindowHandle()
           
 Set<String> getWindowHandles()
           
 boolean isJavascriptEnabled()
           
 boolean isOnline()
           
 org.openqa.selenium.html5.Location location()
           
 org.openqa.selenium.WebDriver.Options manage()
           
 org.openqa.selenium.WebDriver.Navigation navigate()
           
 void onLocationChanged(android.location.Location location)
           
 void onProviderDisabled(String s)
           
 void onProviderEnabled(String s)
           
 void onStatusChanged(String s, int i, android.os.Bundle bundle)
           
protected  Object processJsonObject(Object res)
           
 void quit()
           
 void rotate(org.openqa.selenium.ScreenOrientation orientation)
           
 void setAcceptSslCerts(boolean accept)
           
 void setLocation(org.openqa.selenium.html5.Location loc)
           
 void setOnline(boolean online)
           
 void setProxy(String host, int port)
           
 org.openqa.selenium.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 Object getView()

getActivity

public android.app.Activity getActivity()

getCurrentUrl

public String getCurrentUrl()
Specified by:
getCurrentUrl in interface org.openqa.selenium.WebDriver

getTitle

public String getTitle()
Specified by:
getTitle in interface org.openqa.selenium.WebDriver

get

public void get(String url)
Specified by:
get in interface org.openqa.selenium.WebDriver

getPageSource

public String getPageSource()
Specified by:
getPageSource in interface org.openqa.selenium.WebDriver

close

public void close()
Specified by:
close in interface org.openqa.selenium.WebDriver

quit

public void quit()
Specified by:
quit in interface org.openqa.selenium.WebDriver

findElement

public org.openqa.selenium.WebElement findElement(org.openqa.selenium.By by)
Specified by:
findElement in interface org.openqa.selenium.SearchContext
Specified by:
findElement in interface org.openqa.selenium.WebDriver

findElements

public List<org.openqa.selenium.WebElement> findElements(org.openqa.selenium.By by)
Specified by:
findElements in interface org.openqa.selenium.SearchContext
Specified by:
findElements in interface org.openqa.selenium.WebDriver

getStatus

public org.openqa.selenium.html5.AppCacheStatus getStatus()
Specified by:
getStatus in interface org.openqa.selenium.html5.ApplicationCache

getWindowHandles

public Set<String> getWindowHandles()
Specified by:
getWindowHandles in interface org.openqa.selenium.WebDriver

getWindowHandle

public String getWindowHandle()
Specified by:
getWindowHandle in interface org.openqa.selenium.WebDriver

switchTo

public org.openqa.selenium.WebDriver.TargetLocator switchTo()
Specified by:
switchTo in interface org.openqa.selenium.WebDriver

getLocalStorage

public org.openqa.selenium.html5.LocalStorage getLocalStorage()
Specified by:
getLocalStorage in interface org.openqa.selenium.html5.WebStorage

getSessionStorage

public org.openqa.selenium.html5.SessionStorage getSessionStorage()
Specified by:
getSessionStorage in interface org.openqa.selenium.html5.WebStorage

navigate

public org.openqa.selenium.WebDriver.Navigation navigate()
Specified by:
navigate in interface org.openqa.selenium.WebDriver

isJavascriptEnabled

public boolean isJavascriptEnabled()

executeScript

public Object executeScript(String script,
                            Object... args)
Specified by:
executeScript in interface org.openqa.selenium.JavascriptExecutor

executeAsyncScript

public Object executeAsyncScript(String script,
                                 Object... args)
Specified by:
executeAsyncScript in interface org.openqa.selenium.JavascriptExecutor

processJsonObject

protected Object processJsonObject(Object res)
                            throws org.json.JSONException
Throws:
org.json.JSONException

setProxy

public void setProxy(String host,
                     int port)

manage

public org.openqa.selenium.WebDriver.Options manage()
Specified by:
manage in interface org.openqa.selenium.WebDriver

location

public org.openqa.selenium.html5.Location location()
Specified by:
location in interface org.openqa.selenium.html5.LocationContext

setLocation

public void setLocation(org.openqa.selenium.html5.Location loc)
Specified by:
setLocation in interface org.openqa.selenium.html5.LocationContext

onLocationChanged

public void onLocationChanged(android.location.Location location)
Specified by:
onLocationChanged in interface android.location.LocationListener

onStatusChanged

public void onStatusChanged(String s,
                            int i,
                            android.os.Bundle bundle)
Specified by:
onStatusChanged in interface android.location.LocationListener

onProviderEnabled

public void onProviderEnabled(String s)
Specified by:
onProviderEnabled in interface android.location.LocationListener

onProviderDisabled

public void onProviderDisabled(String s)
Specified by:
onProviderDisabled in interface android.location.LocationListener

getScreenshotAs

public <X> X getScreenshotAs(org.openqa.selenium.OutputType<X> target)
                  throws org.openqa.selenium.WebDriverException
Specified by:
getScreenshotAs in interface org.openqa.selenium.TakesScreenshot
Throws:
org.openqa.selenium.WebDriverException

getOrientation

public org.openqa.selenium.ScreenOrientation getOrientation()
Specified by:
getOrientation in interface org.openqa.selenium.Rotatable

rotate

public void rotate(org.openqa.selenium.ScreenOrientation orientation)
Specified by:
rotate in interface org.openqa.selenium.Rotatable

isOnline

public boolean isOnline()
Specified by:
isOnline in interface org.openqa.selenium.html5.BrowserConnection

setOnline

public void setOnline(boolean online)
               throws org.openqa.selenium.WebDriverException
Specified by:
setOnline in interface org.openqa.selenium.html5.BrowserConnection
Throws:
org.openqa.selenium.WebDriverException

getTouch

public org.openqa.selenium.TouchScreen getTouch()
Specified by:
getTouch in interface org.openqa.selenium.HasTouchScreen


Copyright © 2013. All Rights Reserved.