public abstract class AppiumDriver extends org.openqa.selenium.remote.RemoteWebDriver implements MobileDriver, org.openqa.selenium.ContextAware, org.openqa.selenium.Rotatable, FindsByAccessibilityId, org.openqa.selenium.html5.LocationContext, DeviceActionShortcuts, TouchShortcuts, InteractsWithFiles, InteractsWithApps, ScrollsTo, HasAppStrings
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) |
org.openqa.selenium.WebElement |
findElementByAccessibilityId(String using) |
List<org.openqa.selenium.WebElement> |
findElementsByAccessibilityId(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, 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, waitclose, findElement, findElements, 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 valueprotected 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 valuesImmutableMappublic org.openqa.selenium.remote.Response execute(String driverCommand, Map<String,?> parameters)
execute in interface MobileDriverexecute in class org.openqa.selenium.remote.RemoteWebDriverprotected 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()
InteractsWithAppsresetApp in interface InteractsWithAppsInteractsWithApps.resetApp()public boolean isAppInstalled(String bundleId)
InteractsWithAppsisAppInstalled in interface InteractsWithAppsbundleId - bundleId of the appInteractsWithApps.isAppInstalled(String)public void installApp(String appPath)
InteractsWithAppsinstallApp in interface InteractsWithAppsappPath - path to app to installInteractsWithApps.installApp(String)public void removeApp(String bundleId)
InteractsWithAppsremoveApp in interface InteractsWithAppsbundleId - the bunble identifier (or app id) of the app to removeInteractsWithApps.removeApp(String)public void launchApp()
InteractsWithAppslaunchApp in interface InteractsWithAppsInteractsWithApps.launchApp()public void closeApp()
InteractsWithAppscloseApp in interface InteractsWithAppsInteractsWithApps.closeApp()public void runAppInBackground(int seconds)
InteractsWithAppsrunAppInBackground in interface InteractsWithAppsseconds - Number of seconds to run App in backgroundInteractsWithApps.runAppInBackground(int)public void hideKeyboard()
DeviceActionShortcutshideKeyboard in interface DeviceActionShortcutsDeviceActionShortcuts.hideKeyboard()public byte[] pullFile(String remotePath)
pullFile in interface 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.pullFile(String)public byte[] pullFolder(String remotePath)
InteractsWithFilespullFolder in interface 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)
PerformsTouchActionsperformTouchAction in interface PerformsTouchActionstouchAction - A TouchAction object, which contains a list of individual
touch actions to performPerformsTouchActions.performTouchAction(TouchAction)public void performMultiTouchAction(MultiTouchAction multiAction)
PerformsTouchActionsperformMultiTouchAction in interface PerformsTouchActionsmultiAction - the MultiTouchAction object to perform.PerformsTouchActions.performMultiTouchAction(MultiTouchAction)public void tap(int fingers,
org.openqa.selenium.WebElement element,
int duration)
TouchShortcutstap in interface 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)
TouchShortcutstap in interface 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)
TouchShortcutsswipe in interface 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)
pinch in interface TouchShortcutsel - The element to pinchpublic void pinch(int x,
int y)
pinch in interface TouchShortcutsx - x coordinate to terminate the pinch ony - y coordinate to terminate the pinch onpublic void zoom(org.openqa.selenium.WebElement el)
zoom in interface TouchShortcutsel - The element to pinchpublic void zoom(int x,
int y)
zoom in interface TouchShortcutsx - 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)
context in interface org.openqa.selenium.ContextAwarepublic Set<String> getContextHandles()
getContextHandles in interface org.openqa.selenium.ContextAwarepublic String getContext()
getContext in interface org.openqa.selenium.ContextAwarepublic void rotate(org.openqa.selenium.ScreenOrientation orientation)
rotate in interface org.openqa.selenium.Rotatablepublic org.openqa.selenium.ScreenOrientation getOrientation()
getOrientation in interface org.openqa.selenium.Rotatablepublic org.openqa.selenium.WebElement findElementByAccessibilityId(String using)
findElementByAccessibilityId in interface FindsByAccessibilityIdpublic List<org.openqa.selenium.WebElement> findElementsByAccessibilityId(String using)
findElementsByAccessibilityId in interface FindsByAccessibilityIdpublic org.openqa.selenium.html5.Location location()
location in interface org.openqa.selenium.html5.LocationContextpublic void setLocation(org.openqa.selenium.html5.Location location)
setLocation in interface org.openqa.selenium.html5.LocationContextpublic String getAppStrings()
HasAppStringsgetAppStrings in interface HasAppStringsHasAppStrings.getAppStrings()public String getAppStrings(String language)
HasAppStringsgetAppStrings in interface 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)
Copyright © 2015. All rights reserved.