public class AndroidDriver extends AppiumDriver implements AndroidDeviceActionShortcuts, HasAppStrings, HasNetworkConnection, PushesFiles, StartsActivity, FindsByAndroidUIAutomator
org.openqa.selenium.remote.RemoteWebDriver.RemoteTargetLocator, org.openqa.selenium.remote.RemoteWebDriver.RemoteWebDriverOptions, org.openqa.selenium.remote.RemoteWebDriver.Whenorg.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.WindowKEY_CODE, PATH| Constructor and Description |
|---|
AndroidDriver(URL remoteAddress,
org.openqa.selenium.Capabilities desiredCapabilities) |
| Modifier and Type | Method and Description |
|---|---|
String |
currentActivity()
Get the current activity being run on the mobile device
|
void |
endTestCoverage(String intent,
String path)
Get test-coverage data
|
org.openqa.selenium.WebElement |
findElementByAndroidUIAutomator(String using) |
List<org.openqa.selenium.WebElement> |
findElementsByAndroidUIAutomator(String using) |
String |
getAppStrings()
Get all defined Strings from an Android app for the default language
|
String |
getAppStrings(String language)
Get all defined Strings from an Android app for the specified language
|
NetworkConnectionSetting |
getNetworkConnection()
Get the current network settings of the device.
|
void |
ignoreUnimportantViews(Boolean compress)
Set the `ignoreUnimportantViews` setting.
|
boolean |
isLocked()
Check if the device is locked.
|
void |
openNotifications()
Open the notification shade, on Android devices.
|
void |
pushFile(String remotePath,
byte[] base64Data)
Save base64 encoded data as a file on the remote mobile device.
|
MobileElement |
scrollTo(String text)
Scroll forward to the element which has a description or name which contains the input text.
|
MobileElement |
scrollToExact(String text)
Scroll forward to the element which has a description or name which exactly matches the input text.
|
void |
sendKeyEvent(int key,
Integer metastate)
Send a key event along with an Android metastate to an Android device
Metastates are things like *shift* to get uppercase characters
|
void |
setNetworkConnection(NetworkConnectionSetting connection)
Set the network connection of the device.
|
void |
startActivity(String appPackage,
String appActivity)
This method should start arbitrary activity during a test.
|
void |
startActivity(String appPackage,
String appActivity,
String appWaitPackage,
String appWaitActivity)
This method should start arbitrary activity during a test.
|
_isNotNullOrEmpty, _isNotNullOrEmpty, closeApp, context, execute, execute, findElementByAccessibilityId, findElementsByAccessibilityId, getCommandImmutableMap, getCommandImmutableMap, getContext, getContextHandles, getExecuteMethod, getOrientation, getRemoteAddress, getSettings, hideKeyboard, installApp, isAppInstalled, launchApp, location, lockScreen, performMultiTouchAction, performTouchAction, pinch, pinch, pullFile, pullFolder, removeApp, resetApp, rotate, runAppInBackground, sendKeyEvent, setLocation, setSetting, substituteMobilePlatform, swipe, tap, tap, zoom, zoomclose, executeAsyncScript, executeScript, findElement, findElement, findElementByClassName, findElementByCssSelector, findElementById, findElementByLinkText, findElementByName, findElementByPartialLinkText, findElementByTagName, findElementByXPath, findElements, findElements, findElementsByClassName, findElementsByCssSelector, findElementsById, findElementsByLinkText, findElementsByName, findElementsByPartialLinkText, findElementsByTagName, findElementsByXPath, get, getCapabilities, getCommandExecutor, getCurrentUrl, getElementConverter, getErrorHandler, getFileDetector, getKeyboard, getMouse, getPageSource, getRemoteStatus, getScreenshotAs, getSessionId, getTitle, getWindowHandle, getWindowHandles, log, manage, navigate, quit, setCommandExecutor, setElementConverter, setErrorHandler, setFileDetector, setFoundBy, setLogLevel, setSessionId, startClient, startSession, startSession, stopClient, switchTo, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waithideKeyboard, sendKeyEventpullFile, pullFolderpublic AndroidDriver(URL remoteAddress, org.openqa.selenium.Capabilities desiredCapabilities)
public MobileElement scrollTo(String text)
public MobileElement scrollToExact(String text)
scrollToExact in interface ScrollsTotext - public void sendKeyEvent(int key,
Integer metastate)
AndroidDeviceActionShortcutssendKeyEvent in interface AndroidDeviceActionShortcutskey - code for the key pressed on the Android devicemetastate - metastate for the keypressAndroidKeyCode,
AndroidKeyMetastate,
AndroidDeviceActionShortcuts.sendKeyEvent(int, Integer)public String getAppStrings()
HasAppStringsgetAppStrings in interface HasAppStringsHasAppStrings.getAppStrings()public String getAppStrings(String language)
HasAppStringsgetAppStrings in interface HasAppStringslanguage - strings language codeHasAppStrings.getAppStrings(String)public NetworkConnectionSetting getNetworkConnection()
HasNetworkConnectiongetNetworkConnection in interface HasNetworkConnectionHasNetworkConnection.getNetworkConnection()public void setNetworkConnection(NetworkConnectionSetting connection)
HasNetworkConnectionsetNetworkConnection in interface HasNetworkConnectionconnection - The NetworkConnectionSetting configuration to use for the
deviceHasNetworkConnection.setNetworkConnection(NetworkConnectionSetting)public void pushFile(String remotePath, byte[] base64Data)
PushesFilespushFile in interface PushesFilesremotePath - Path to file to write data to on remote devicebase64Data - Base64 encoded byte array of data to write to remote devicePushesFiles.pushFile(String, byte[])public void startActivity(String appPackage, String appActivity, String appWaitPackage, String appWaitActivity) throws IllegalArgumentException
StartsActivitystartActivity in interface StartsActivityappPackage - The package containing the activity. [Required]appActivity - The activity to start. [Required]appWaitPackage - Automation will begin after this package starts. [Optional]appWaitActivity - Automation will begin after this activity starts. [Optional]IllegalArgumentExceptionStartsActivity.startActivity(String, String, String, String)public void startActivity(String appPackage, String appActivity) throws IllegalArgumentException
StartsActivitystartActivity in interface StartsActivityappPackage - The package containing the activity. [Required]appActivity - The activity to start. [Required]IllegalArgumentExceptionStartsActivity.startActivity(String, String)public void endTestCoverage(String intent, String path)
intent - intent to broadcastpath - path to .ec filepublic String currentActivity()
public void openNotifications()
public boolean isLocked()
public void ignoreUnimportantViews(Boolean compress)
compress - ignores unimportant views if true, doesn't ignore otherwise.public org.openqa.selenium.WebElement findElementByAndroidUIAutomator(String using)
findElementByAndroidUIAutomator in interface FindsByAndroidUIAutomatorpublic List<org.openqa.selenium.WebElement> findElementsByAndroidUIAutomator(String using)
findElementsByAndroidUIAutomator in interface FindsByAndroidUIAutomatorCopyright © 2014. All rights reserved.