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:WebElementTouchableElementRemoteWebElementMobileElement and its subclasses that designed specifically for each target mobile OS (still Android and iOS)public abstract class AppiumDriver<RequiredElementType extends org.openqa.selenium.WebElement>
extends org.openqa.selenium.remote.RemoteWebDriver
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.Window| Modifier and Type | Field and Description |
|---|---|
protected String |
KEY_CODE |
protected String |
PATH |
| Constructor and Description |
|---|
AppiumDriver(URL remoteAddress,
org.openqa.selenium.Capabilities desiredCapabilities) |
| Modifier and Type | Method and Description |
|---|---|
protected static boolean |
_isNotNullOrEmpty(Object ob) |
protected static boolean |
_isNotNullOrEmpty(String str)
Checks if a string is null, empty, or whitespace.
|
void |
closeApp()
Close the app which was provided in the capabilities at session creation
|
org.openqa.selenium.WebDriver |
context(String name) |
protected org.openqa.selenium.remote.Response |
execute(String command) |
org.openqa.selenium.remote.Response |
execute(String driverCommand,
Map<String,?> parameters) |
T |
findElement(org.openqa.selenium.By by) |
T |
findElementByAccessibilityId(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> |
findElements(org.openqa.selenium.By by) |
List<RequiredElementType> |
findElementsByAccessibilityId(String using) |
List<RequiredElementType> |
findElementsByClassName(String using) |
List<RequiredElementType> |
findElementsByCssSelector(String using) |
List<RequiredElementType> |
findElementsById(String id) |
List<RequiredElementType> |
findElementsByLinkText(String using) |
List<RequiredElementType> |
findElementsByName(String using) |
List<RequiredElementType> |
findElementsByPartialLinkText(String using) |
List<RequiredElementType> |
findElementsByTagName(String using) |
List<RequiredElementType> |
findElementsByXPath(String using) |
String |
getAppStrings()
Get all defined Strings from an app for the default language
|
String |
getAppStrings(String language)
Get all defined Strings from an app for the specified language
|
protected static com.google.common.collect.ImmutableMap<String,Object> |
getCommandImmutableMap(String[] params,
Object[] values) |
protected static com.google.common.collect.ImmutableMap<String,Object> |
getCommandImmutableMap(String param,
Object value) |
String |
getContext() |
Set<String> |
getContextHandles() |
org.openqa.selenium.remote.ExecuteMethod |
getExecuteMethod() |
org.openqa.selenium.ScreenOrientation |
getOrientation() |
URL |
getRemoteAddress() |
com.google.gson.JsonObject |
getSettings()
Get settings stored for this test session It's probably better to use a
convenience function, rather than use this function directly.
|
void |
hideKeyboard()
Hides the keyboard if it is showing.
|
void |
installApp(String appPath)
Install an app on the mobile device
|
boolean |
isAppInstalled(String bundleId)
Checks if an app is installed on the device
|
void |
launchApp()
Launch the app which was provided in the capabilities at session creation
|
org.openqa.selenium.html5.Location |
location() |
void |
lockScreen(int seconds)
Lock the device (bring it to the lock screen) for a given number of
seconds
|
void |
performMultiTouchAction(MultiTouchAction multiAction)
Performs multiple TouchAction gestures at the same time, to simulate
multiple fingers/touch inputs.
|
TouchAction |
performTouchAction(TouchAction touchAction)
Performs a chain of touch actions, which together can be considered an
entire gesture.
|
void |
pinch(int x,
int y)
Convenience method for pinching an element on the screen.
|
void |
pinch(org.openqa.selenium.WebElement el)
Convenience method for pinching an element on the screen.
|
byte[] |
pullFile(String remotePath) |
byte[] |
pullFolder(String remotePath)
Pull a folder from the simulator/device.
|
void |
removeApp(String bundleId)
Remove the specified app from the device (uninstall)
|
void |
resetApp()
Reset the currently running app for this session
|
void |
rotate(org.openqa.selenium.ScreenOrientation orientation) |
void |
runAppInBackground(int seconds)
Runs the current app as a background app for the number of seconds
requested.
|
void |
setLocation(org.openqa.selenium.html5.Location location) |
protected void |
setSetting(AppiumSetting setting,
Object value)
Set a setting for this test session It's probably better to use a
convenience function, rather than use this function directly.
|
protected static org.openqa.selenium.Capabilities |
substituteMobilePlatform(org.openqa.selenium.Capabilities originalCapabilities,
String newPlatform) |
void |
swipe(int startx,
int starty,
int endx,
int endy,
int duration)
Convenience method for swiping across the screen
|
void |
tap(int fingers,
int x,
int y,
int duration)
Convenience method for tapping a position on the screen
|
void |
tap(int fingers,
org.openqa.selenium.WebElement element,
int duration)
Convenience method for tapping the center of an element on the screen
|
void |
zoom(int x,
int y)
Convenience method for "zooming in" on an element on the screen.
|
void |
zoom(org.openqa.selenium.WebElement el)
Convenience method for "zooming in" on an element on the screen.
|
close, executeAsyncScript, executeScript, findElement, findElements, 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, waitclose, get, getCurrentUrl, getPageSource, getTitle, getWindowHandle, getWindowHandles, manage, navigate, quit, switchToscrollTo, scrollToExactprotected final String KEY_CODE
protected final String PATH
public AppiumDriver(URL remoteAddress, org.openqa.selenium.Capabilities desiredCapabilities)
protected static org.openqa.selenium.Capabilities substituteMobilePlatform(org.openqa.selenium.Capabilities originalCapabilities,
String newPlatform)
originalCapabilities - the given CapabilitiesnewPlatform - a MobileCapabilityType.PLATFORM_NAME value which has
to be set upCapabilities with changed mobile platform valuepublic List<RequiredElementType> findElements(org.openqa.selenium.By by)
findElements in interface GenericSearchContext<RequiredElementType extends org.openqa.selenium.WebElement>findElements in interface org.openqa.selenium.SearchContextfindElements in interface org.openqa.selenium.WebDriverpublic List<RequiredElementType> findElementsById(String id)
findElementsById in interface GenericFindsById<RequiredElementType extends org.openqa.selenium.WebElement>findElementsById in interface org.openqa.selenium.internal.FindsByIdpublic List<RequiredElementType> findElementsByLinkText(String using)
findElementsByLinkText in interface GenericFindsByLinkText<RequiredElementType extends org.openqa.selenium.WebElement>findElementsByLinkText in interface org.openqa.selenium.internal.FindsByLinkTextpublic List<RequiredElementType> findElementsByPartialLinkText(String using)
findElementsByPartialLinkText in interface GenericFindsByLinkText<RequiredElementType extends org.openqa.selenium.WebElement>findElementsByPartialLinkText in interface org.openqa.selenium.internal.FindsByLinkTextpublic List<RequiredElementType> findElementsByTagName(String using)
findElementsByTagName in interface GenericFindsByTagName<RequiredElementType extends org.openqa.selenium.WebElement>findElementsByTagName in interface org.openqa.selenium.internal.FindsByTagNamepublic List<RequiredElementType> findElementsByName(String using)
findElementsByName in interface GenericFindsByName<RequiredElementType extends org.openqa.selenium.WebElement>findElementsByName in interface org.openqa.selenium.internal.FindsByNamepublic List<RequiredElementType> findElementsByClassName(String using)
findElementsByClassName in interface GenericFindsByClassName<RequiredElementType extends org.openqa.selenium.WebElement>findElementsByClassName in interface org.openqa.selenium.internal.FindsByClassNamepublic List<RequiredElementType> findElementsByCssSelector(String using)
findElementsByCssSelector in interface GenericFindsByCssSelector<RequiredElementType extends org.openqa.selenium.WebElement>findElementsByCssSelector in interface org.openqa.selenium.internal.FindsByCssSelectorpublic List<RequiredElementType> findElementsByXPath(String using)
findElementsByXPath in interface GenericFindsByXPath<RequiredElementType extends org.openqa.selenium.WebElement>findElementsByXPath in interface org.openqa.selenium.internal.FindsByXPathpublic List<RequiredElementType> findElementsByAccessibilityId(String using)
findElementsByAccessibilityId in interface FindsByAccessibilityId<org.openqa.selenium.WebElement>protected static com.google.common.collect.ImmutableMap<String,Object> getCommandImmutableMap(String param, Object value)
param - is a parameter namevalue - is the parameter valueImmutableMapprotected static com.google.common.collect.ImmutableMap<String,Object> getCommandImmutableMap(String[] params, Object[] values)
params - is the array with parameter namesvalues - is the array with parameter valuesImmutableMapprotected org.openqa.selenium.remote.Response execute(String command)
execute in class org.openqa.selenium.remote.RemoteWebDriverpublic org.openqa.selenium.remote.ExecuteMethod getExecuteMethod()
getExecuteMethod in class org.openqa.selenium.remote.RemoteWebDriverpublic void resetApp()
InteractsWithAppsInteractsWithApps.resetApp()public boolean isAppInstalled(String bundleId)
InteractsWithAppsbundleId - bundleId of the appInteractsWithApps.isAppInstalled(String)public void installApp(String appPath)
InteractsWithAppsappPath - path to app to installInteractsWithApps.installApp(String)public void removeApp(String bundleId)
InteractsWithAppsbundleId - the bunble identifier (or app id) of the app to removeInteractsWithApps.removeApp(String)public void launchApp()
InteractsWithAppsInteractsWithApps.launchApp()public void closeApp()
InteractsWithAppsInteractsWithApps.closeApp()public void runAppInBackground(int seconds)
InteractsWithAppsseconds - Number of seconds to run App in backgroundInteractsWithApps.runAppInBackground(int)public void hideKeyboard()
DeviceActionShortcutsDeviceActionShortcuts.hideKeyboard()public byte[] pullFile(String remotePath)
remotePath - On Android and iOS, this is either the path to the file
(relative to the root of the app's file system). On iOS only,
if path starts with /AppName.app, which will be replaced with
the application's .app directoryInteractsWithFiles.pullFile(String)public byte[] pullFolder(String remotePath)
InteractsWithFilesremotePath - On Android and iOS, this is either the path to the file
(relative to the root of the app's file system). On iOS only,
if path starts with /AppName.app, which will be replaced with
the application's .app directoryInteractsWithFiles.pullFolder(String)public TouchAction performTouchAction(TouchAction touchAction)
PerformsTouchActionstouchAction - A TouchAction object, which contains a list of individual
touch actions to performPerformsTouchActions.performTouchAction(TouchAction)public void performMultiTouchAction(MultiTouchAction multiAction)
PerformsTouchActionsmultiAction - the MultiTouchAction object to perform.PerformsTouchActions.performMultiTouchAction(MultiTouchAction)public void tap(int fingers,
org.openqa.selenium.WebElement element,
int duration)
TouchShortcutsfingers - number of fingers/appendages to tap withelement - element to tapduration - how long between pressing down, and lifting fingers/appendagesTouchShortcuts.tap(int, WebElement, int)public void tap(int fingers,
int x,
int y,
int duration)
TouchShortcutsfingers - number of fingers/appendages to tap withx - x coordinatey - y coordinateTouchShortcuts.tap(int, int, int, int)public void swipe(int startx,
int starty,
int endx,
int endy,
int duration)
TouchShortcutsstartx - starting x coordinatestarty - starting y coordinateendx - ending x coordinateendy - ending y coordinateduration - amount of time in milliseconds for the entire swipe action to
takeTouchShortcuts.swipe(int, int, int, int, int)public void pinch(org.openqa.selenium.WebElement el)
el - The element to pinchpublic void pinch(int x,
int y)
x - x coordinate to terminate the pinch ony - y coordinate to terminate the pinch onpublic void zoom(org.openqa.selenium.WebElement el)
el - The element to pinchpublic void zoom(int x,
int y)
x - x coordinate to start zoom ony - y coordinate to start zoom onpublic com.google.gson.JsonObject getSettings()
protected void setSetting(AppiumSetting setting, Object value)
setting - AppiumSetting you wish to setvalue - value of the settingpublic void lockScreen(int seconds)
seconds - number of seconds to lock the screen forpublic org.openqa.selenium.WebDriver context(String name)
public String getContext()
public void rotate(org.openqa.selenium.ScreenOrientation orientation)
public org.openqa.selenium.ScreenOrientation getOrientation()
public org.openqa.selenium.html5.Location location()
public void setLocation(org.openqa.selenium.html5.Location location)
public String getAppStrings()
HasAppStringsHasAppStrings.getAppStrings()public String getAppStrings(String language)
HasAppStringslanguage - strings language codeHasAppStrings.getAppStrings(String)public URL getRemoteAddress()
protected static boolean _isNotNullOrEmpty(String str)
str - String to check.protected static boolean _isNotNullOrEmpty(Object ob)
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)
findElementByLinkText in interface GenericFindsByLinkText<T extends org.openqa.selenium.WebElement>findElementByLinkText in interface org.openqa.selenium.internal.FindsByLinkTextfindElementByLinkText in class org.openqa.selenium.remote.RemoteWebDriverpublic T findElementByPartialLinkText(String using)
findElementByPartialLinkText in interface GenericFindsByLinkText<T extends org.openqa.selenium.WebElement>findElementByPartialLinkText in interface org.openqa.selenium.internal.FindsByLinkTextfindElementByPartialLinkText in class org.openqa.selenium.remote.RemoteWebDriverpublic 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)
findElementByCssSelector in interface GenericFindsByCssSelector<T extends org.openqa.selenium.WebElement>findElementByCssSelector in interface org.openqa.selenium.internal.FindsByCssSelectorfindElementByCssSelector in class org.openqa.selenium.remote.RemoteWebDriverpublic 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)
findElementByAccessibilityId in interface FindsByAccessibilityId<org.openqa.selenium.WebElement>Copyright © 2015. All rights reserved.