RequiredElementType - the required type of class which implement WebElement.
Instances of the defined type will be returned via findElement* and findElements*.
Warning (!!!). Allowed types:
WebElement
TouchableElement
RemoteWebElement
MobileElement
AndroidElementpublic class AndroidDriver<RequiredElementType extends org.openqa.selenium.WebElement> extends AppiumDriver<RequiredElementType> implements AndroidDeviceActionShortcuts, HasNetworkConnection, PushesFiles, StartsActivity, FindsByAndroidUIAutomator<RequiredElementType>
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(AppiumDriverLocalService service,
org.openqa.selenium.Capabilities desiredCapabilities) |
AndroidDriver(AppiumDriverLocalService service,
org.openqa.selenium.remote.http.HttpClient.Factory httpClientFactory,
org.openqa.selenium.Capabilities desiredCapabilities) |
AndroidDriver(AppiumServiceBuilder builder,
org.openqa.selenium.Capabilities desiredCapabilities) |
AndroidDriver(AppiumServiceBuilder builder,
org.openqa.selenium.remote.http.HttpClient.Factory httpClientFactory,
org.openqa.selenium.Capabilities desiredCapabilities) |
AndroidDriver(org.openqa.selenium.Capabilities desiredCapabilities) |
AndroidDriver(org.openqa.selenium.remote.http.HttpClient.Factory httpClientFactory,
org.openqa.selenium.Capabilities desiredCapabilities) |
AndroidDriver(URL remoteAddress,
org.openqa.selenium.Capabilities desiredCapabilities) |
AndroidDriver(URL remoteAddress,
org.openqa.selenium.remote.http.HttpClient.Factory httpClientFactory,
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.remote.Response |
execute(String driverCommand,
Map<String,?> parameters) |
T |
findElement(org.openqa.selenium.By by) |
T |
findElementByAccessibilityId(String using) |
RequiredElementType |
findElementByAndroidUIAutomator(String using) |
T |
findElementByClassName(String using) |
T |
findElementByCssSelector(String using) |
T |
findElementById(String id) |
T |
findElementByLinkText(String using) |
T |
findElementByName(String using) |
T |
findElementByPartialLinkText(String using) |
T |
findElementByTagName(String using) |
T |
findElementByXPath(String using) |
List<RequiredElementType> |
findElementsByAndroidUIAutomator(String using) |
org.openqa.selenium.interactions.Mouse |
getMouse()
Deprecated.
|
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 |
lockDevice()
This method locks a device.
|
void |
longPressKeyCode(int key)
Send a long key event to the device
|
void |
longPressKeyCode(int key,
Integer metastate)
Send a long key event along with an Android metastate to an Android device
Metastates are things like *shift* to get uppercase characters
|
void |
openNotifications()
Open the notification shade, on Android devices.
|
void |
pressKeyCode(int key)
Send a key event to the device
|
void |
pressKeyCode(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 |
pushFile(String remotePath,
byte[] base64Data)
Save base64 encoded data as a file on the remote mobile device.
|
RequiredElementType |
scrollTo(String text)
Scroll to an element which contains the given text.
|
RequiredElementType |
scrollToExact(String text)
Scroll to an element with the given text.
|
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.
|
void |
startActivity(String appPackage,
String appActivity,
String appWaitPackage,
String appWaitActivity,
boolean stopApp)
This method should start arbitrary activity during a test.
|
void |
toggleLocationServices() |
void |
unlockDevice()
This method unlocks a device.
|
_isNotNullOrEmpty, _isNotNullOrEmpty, closeApp, context, execute, findElements, findElementsByAccessibilityId, findElementsByClassName, findElementsByCssSelector, findElementsById, findElementsByLinkText, findElementsByName, findElementsByPartialLinkText, findElementsByTagName, findElementsByXPath, getAppStringMap, getAppStringMap, getAppStringMap, getAppStrings, getAppStrings, getCommandImmutableMap, getCommandImmutableMap, getContext, getContextHandles, getDeviceTime, getExecuteMethod, getOrientation, getRemoteAddress, getSettings, hideKeyboard, installApp, isAppInstalled, launchApp, location, lockScreen, performMultiTouchAction, performTouchAction, pinch, pinch, pullFile, pullFolder, removeApp, resetApp, rotate, runAppInBackground, setLocation, setSetting, substituteMobilePlatform, swipe, tap, tap, zoom, zoomclose, executeAsyncScript, executeScript, findElement, findElements, get, getCapabilities, getCommandExecutor, getCurrentUrl, getElementConverter, getErrorHandler, getFileDetector, getKeyboard, getPageSource, getScreenshotAs, getSessionId, getTitle, getW3CStandardComplianceLevel, 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, waitgetDeviceTime, hideKeyboardpullFile, pullFolderpublic AndroidDriver(URL remoteAddress, org.openqa.selenium.Capabilities desiredCapabilities)
public AndroidDriver(URL remoteAddress, org.openqa.selenium.remote.http.HttpClient.Factory httpClientFactory, org.openqa.selenium.Capabilities desiredCapabilities)
public AndroidDriver(AppiumDriverLocalService service, org.openqa.selenium.Capabilities desiredCapabilities)
public AndroidDriver(AppiumDriverLocalService service, org.openqa.selenium.remote.http.HttpClient.Factory httpClientFactory, org.openqa.selenium.Capabilities desiredCapabilities)
public AndroidDriver(AppiumServiceBuilder builder, org.openqa.selenium.Capabilities desiredCapabilities)
public AndroidDriver(AppiumServiceBuilder builder, org.openqa.selenium.remote.http.HttpClient.Factory httpClientFactory, org.openqa.selenium.Capabilities desiredCapabilities)
public AndroidDriver(org.openqa.selenium.remote.http.HttpClient.Factory httpClientFactory,
org.openqa.selenium.Capabilities desiredCapabilities)
public AndroidDriver(org.openqa.selenium.Capabilities desiredCapabilities)
public RequiredElementType scrollTo(String text)
ScrollsToscrollTo in interface ScrollsTo<org.openqa.selenium.WebElement>scrollTo in class AppiumDriver<RequiredElementType extends org.openqa.selenium.WebElement>text - description or text of an element scroll topublic RequiredElementType scrollToExact(String text)
ScrollsToscrollToExact in interface ScrollsTo<org.openqa.selenium.WebElement>scrollToExact in class AppiumDriver<RequiredElementType extends org.openqa.selenium.WebElement>text - description or text of an element scroll topublic void pressKeyCode(int key)
pressKeyCode in interface AndroidDeviceActionShortcutskey - code for the key pressed on the devicepublic void pressKeyCode(int key,
Integer metastate)
AndroidDeviceActionShortcutspressKeyCode in interface AndroidDeviceActionShortcutskey - code for the key pressed on the Android devicemetastate - metastate for the keypressAndroidKeyCode,
AndroidKeyMetastate,
AndroidDeviceActionShortcuts.pressKeyCode(int, Integer)public void longPressKeyCode(int key)
longPressKeyCode in interface AndroidDeviceActionShortcutskey - code for the long key pressed on the devicepublic void longPressKeyCode(int key,
Integer metastate)
AndroidDeviceActionShortcutslongPressKeyCode in interface AndroidDeviceActionShortcutskey - code for the long key pressed on the Android devicemetastate - metastate for the long key pressAndroidKeyCode,
AndroidKeyMetastate,
AndroidDeviceActionShortcuts.pressKeyCode(int, Integer)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, boolean stopApp) 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]stopApp - If true, target app will be stopped. [Optional]IllegalArgumentExceptionStartsActivity.startActivity(String, String, String, String)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 toggleLocationServices()
public void ignoreUnimportantViews(Boolean compress)
compress - ignores unimportant views if true, doesn't ignore otherwise.public RequiredElementType findElementByAndroidUIAutomator(String using) throws org.openqa.selenium.WebDriverException
findElementByAndroidUIAutomator in interface FindsByAndroidUIAutomator<RequiredElementType extends org.openqa.selenium.WebElement>org.openqa.selenium.WebDriverException - This method is not applicable with browser/webview UI.public List<RequiredElementType> findElementsByAndroidUIAutomator(String using) throws org.openqa.selenium.WebDriverException
findElementsByAndroidUIAutomator in interface FindsByAndroidUIAutomator<RequiredElementType extends org.openqa.selenium.WebElement>org.openqa.selenium.WebDriverException - This method is not applicable with browser/webview UI.public void lockDevice()
public void unlockDevice()
public org.openqa.selenium.remote.Response execute(String driverCommand, Map<String,?> parameters)
execute in interface MobileDriverexecute in class org.openqa.selenium.remote.RemoteWebDriverpublic T findElement(org.openqa.selenium.By by)
findElement in interface GenericSearchContext<T extends org.openqa.selenium.WebElement>findElement in interface org.openqa.selenium.SearchContextfindElement in interface org.openqa.selenium.WebDriverfindElement in class org.openqa.selenium.remote.RemoteWebDriverpublic T findElementById(String id)
findElementById in interface GenericFindsById<T extends org.openqa.selenium.WebElement>findElementById in interface org.openqa.selenium.internal.FindsByIdfindElementById in class org.openqa.selenium.remote.RemoteWebDriverpublic T findElementByLinkText(String using) throws org.openqa.selenium.WebDriverException
findElementByLinkText in interface GenericFindsByLinkText<T extends org.openqa.selenium.WebElement>findElementByLinkText in interface org.openqa.selenium.internal.FindsByLinkTextfindElementByLinkText in class org.openqa.selenium.remote.RemoteWebDriverorg.openqa.selenium.WebDriverException - his method doesn't work against native app UI.public T findElementByPartialLinkText(String using) throws org.openqa.selenium.WebDriverException
findElementByPartialLinkText in interface GenericFindsByLinkText<T extends org.openqa.selenium.WebElement>findElementByPartialLinkText in interface org.openqa.selenium.internal.FindsByLinkTextfindElementByPartialLinkText in class org.openqa.selenium.remote.RemoteWebDriverorg.openqa.selenium.WebDriverException - his method doesn't work against native app UI.public T findElementByTagName(String using)
findElementByTagName in interface GenericFindsByTagName<T extends org.openqa.selenium.WebElement>findElementByTagName in interface org.openqa.selenium.internal.FindsByTagNamefindElementByTagName in class org.openqa.selenium.remote.RemoteWebDriverpublic T findElementByName(String using)
findElementByName in interface GenericFindsByName<T extends org.openqa.selenium.WebElement>findElementByName in interface org.openqa.selenium.internal.FindsByNamefindElementByName in class org.openqa.selenium.remote.RemoteWebDriverpublic T findElementByClassName(String using)
findElementByClassName in interface GenericFindsByClassName<T extends org.openqa.selenium.WebElement>findElementByClassName in interface org.openqa.selenium.internal.FindsByClassNamefindElementByClassName in class org.openqa.selenium.remote.RemoteWebDriverpublic T findElementByCssSelector(String using) throws org.openqa.selenium.WebDriverException
findElementByCssSelector in interface GenericFindsByCssSelector<T extends org.openqa.selenium.WebElement>findElementByCssSelector in interface org.openqa.selenium.internal.FindsByCssSelectorfindElementByCssSelector in class org.openqa.selenium.remote.RemoteWebDriverorg.openqa.selenium.WebDriverException - his method doesn't work against native app UI.public T findElementByXPath(String using)
findElementByXPath in interface GenericFindsByXPath<T extends org.openqa.selenium.WebElement>findElementByXPath in interface org.openqa.selenium.internal.FindsByXPathfindElementByXPath in class org.openqa.selenium.remote.RemoteWebDriverpublic T findElementByAccessibilityId(String using) throws org.openqa.selenium.WebDriverException
findElementByAccessibilityId in interface FindsByAccessibilityId<org.openqa.selenium.WebElement>org.openqa.selenium.WebDriverException@Deprecated public org.openqa.selenium.interactions.Mouse getMouse()
getMouse in interface org.openqa.selenium.interactions.HasInputDevicesgetMouse in class org.openqa.selenium.remote.RemoteWebDriverCopyright © 2016. All rights reserved.