RequiredElementType
- means the required type from the list of allowed types below
that implement WebElement
Instances of the defined type will be
returned via findElement* and findElements*.
Warning (!!!). Allowed types:WebElement
TouchableElement
RemoteWebElement
MobileElement
AndroidElement
public 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.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(AppiumDriverLocalService service,
org.openqa.selenium.Capabilities desiredCapabilities) |
AndroidDriver(AppiumServiceBuilder builder,
org.openqa.selenium.Capabilities desiredCapabilities) |
AndroidDriver(org.openqa.selenium.Capabilities desiredCapabilities) |
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.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 |
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 forward to the element which has a description or name which contains the input text.
|
RequiredElementType |
scrollToExact(String text)
Scroll forward to the element which has a description or name which exactly matches the input 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 |
toggleLocationServices() |
_isNotNullOrEmpty, _isNotNullOrEmpty, closeApp, context, execute, findElements, findElementsByAccessibilityId, findElementsByClassName, findElementsByCssSelector, findElementsById, findElementsByLinkText, findElementsByName, findElementsByPartialLinkText, findElementsByTagName, findElementsByXPath, getAppStrings, getAppStrings, getCommandImmutableMap, getCommandImmutableMap, getContext, getContextHandles, 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, zoom
close, executeAsyncScript, executeScript, findElement, findElements, get, getCapabilities, getCommandExecutor, getCurrentUrl, getElementConverter, getErrorHandler, getFileDetector, getKeyboard, getPageSource, 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
pullFile, pullFolder
public AndroidDriver(URL remoteAddress, org.openqa.selenium.Capabilities desiredCapabilities)
public AndroidDriver(AppiumDriverLocalService service, org.openqa.selenium.Capabilities desiredCapabilities)
public AndroidDriver(AppiumServiceBuilder builder, org.openqa.selenium.Capabilities desiredCapabilities)
public AndroidDriver(org.openqa.selenium.Capabilities desiredCapabilities)
public RequiredElementType scrollTo(String text)
scrollTo
in interface ScrollsTo<org.openqa.selenium.WebElement>
scrollTo
in class AppiumDriver<RequiredElementType extends org.openqa.selenium.WebElement>
text
- public RequiredElementType scrollToExact(String text)
scrollToExact
in interface ScrollsTo<org.openqa.selenium.WebElement>
scrollToExact
in class AppiumDriver<RequiredElementType extends org.openqa.selenium.WebElement>
text
- public void pressKeyCode(int key)
pressKeyCode
in interface AndroidDeviceActionShortcuts
key
- code for the key pressed on the devicepublic void pressKeyCode(int key, Integer metastate)
AndroidDeviceActionShortcuts
pressKeyCode
in interface AndroidDeviceActionShortcuts
key
- 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 AndroidDeviceActionShortcuts
key
- code for the long key pressed on the devicepublic void longPressKeyCode(int key, Integer metastate)
AndroidDeviceActionShortcuts
longPressKeyCode
in interface AndroidDeviceActionShortcuts
key
- code for the long key pressed on the Android devicemetastate
- metastate for the long key pressAndroidKeyCode
,
AndroidKeyMetastate
,
AndroidDeviceActionShortcuts.pressKeyCode(int, Integer)
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 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 org.openqa.selenium.remote.Response execute(String driverCommand, Map<String,?> parameters)
execute
in interface MobileDriver
execute
in class org.openqa.selenium.remote.RemoteWebDriver
public T findElement(org.openqa.selenium.By by)
findElement
in interface GenericSearchContext<T extends org.openqa.selenium.WebElement>
findElement
in interface org.openqa.selenium.SearchContext
findElement
in interface org.openqa.selenium.WebDriver
findElement
in class org.openqa.selenium.remote.RemoteWebDriver
public T findElementById(String id)
findElementById
in interface GenericFindsById<T extends org.openqa.selenium.WebElement>
findElementById
in interface org.openqa.selenium.internal.FindsById
findElementById
in class org.openqa.selenium.remote.RemoteWebDriver
public 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.FindsByLinkText
findElementByLinkText
in class org.openqa.selenium.remote.RemoteWebDriver
org.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.FindsByLinkText
findElementByPartialLinkText
in class org.openqa.selenium.remote.RemoteWebDriver
org.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.FindsByTagName
findElementByTagName
in class org.openqa.selenium.remote.RemoteWebDriver
public T findElementByName(String using)
findElementByName
in interface GenericFindsByName<T extends org.openqa.selenium.WebElement>
findElementByName
in interface org.openqa.selenium.internal.FindsByName
findElementByName
in class org.openqa.selenium.remote.RemoteWebDriver
public T findElementByClassName(String using)
findElementByClassName
in interface GenericFindsByClassName<T extends org.openqa.selenium.WebElement>
findElementByClassName
in interface org.openqa.selenium.internal.FindsByClassName
findElementByClassName
in class org.openqa.selenium.remote.RemoteWebDriver
public 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.FindsByCssSelector
findElementByCssSelector
in class org.openqa.selenium.remote.RemoteWebDriver
org.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.FindsByXPath
findElementByXPath
in class org.openqa.selenium.remote.RemoteWebDriver
public 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.HasInputDevices
getMouse
in class org.openqa.selenium.remote.RemoteWebDriver
Copyright © 2015. All rights reserved.