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.When
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
KEY_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, zoom
close, 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, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
hideKeyboard, sendKeyEvent
pullFile, pullFolder
public AndroidDriver(URL remoteAddress, org.openqa.selenium.Capabilities desiredCapabilities)
public MobileElement scrollTo(String text)
public MobileElement scrollToExact(String text)
scrollToExact
in interface ScrollsTo
text
- public void sendKeyEvent(int key, Integer metastate)
AndroidDeviceActionShortcuts
sendKeyEvent
in interface AndroidDeviceActionShortcuts
key
- code for the key pressed on the Android devicemetastate
- metastate for the keypressAndroidKeyCode
,
AndroidKeyMetastate
,
AndroidDeviceActionShortcuts.sendKeyEvent(int, Integer)
public String getAppStrings()
HasAppStrings
getAppStrings
in interface HasAppStrings
HasAppStrings.getAppStrings()
public String getAppStrings(String language)
HasAppStrings
getAppStrings
in interface HasAppStrings
language
- strings language codeHasAppStrings.getAppStrings(String)
public NetworkConnectionSetting getNetworkConnection()
HasNetworkConnection
getNetworkConnection
in interface HasNetworkConnection
HasNetworkConnection.getNetworkConnection()
public void setNetworkConnection(NetworkConnectionSetting connection)
HasNetworkConnection
setNetworkConnection
in interface HasNetworkConnection
connection
- The NetworkConnectionSetting configuration to use for the
deviceHasNetworkConnection.setNetworkConnection(NetworkConnectionSetting)
public void pushFile(String remotePath, byte[] base64Data)
PushesFiles
pushFile
in interface PushesFiles
remotePath
- 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
StartsActivity
startActivity
in interface StartsActivity
appPackage
- 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]IllegalArgumentException
StartsActivity.startActivity(String, String, String, String)
public void startActivity(String appPackage, String appActivity) throws IllegalArgumentException
StartsActivity
startActivity
in interface StartsActivity
appPackage
- The package containing the activity. [Required]appActivity
- The activity to start. [Required]IllegalArgumentException
StartsActivity.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 FindsByAndroidUIAutomator
public List<org.openqa.selenium.WebElement> findElementsByAndroidUIAutomator(String using)
findElementsByAndroidUIAutomator
in interface FindsByAndroidUIAutomator
Copyright © 2014. All rights reserved.