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 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(AppiumDriverLocalService service,
org.openqa.selenium.Capabilities desiredCapabilities) |
AppiumDriver(AppiumDriverLocalService service,
org.openqa.selenium.remote.http.HttpClient.Factory httpClientFactory,
org.openqa.selenium.Capabilities desiredCapabilities) |
AppiumDriver(AppiumServiceBuilder builder,
org.openqa.selenium.Capabilities desiredCapabilities) |
AppiumDriver(AppiumServiceBuilder builder,
org.openqa.selenium.remote.http.HttpClient.Factory httpClientFactory,
org.openqa.selenium.Capabilities desiredCapabilities) |
AppiumDriver(org.openqa.selenium.Capabilities desiredCapabilities) |
AppiumDriver(org.openqa.selenium.remote.http.HttpClient.Factory httpClientFactory,
org.openqa.selenium.Capabilities desiredCapabilities) |
AppiumDriver(URL remoteAddress,
org.openqa.selenium.Capabilities desiredCapabilities) |
AppiumDriver(URL remoteAddress,
org.openqa.selenium.remote.http.HttpClient.Factory httpClientFactory,
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) |
Map<String,String> |
getAppStringMap()
Get all defined Strings from an app for the default language
|
Map<String,String> |
getAppStringMap(String language)
Get all defined Strings from an app for the specified language
|
Map<String,String> |
getAppStringMap(String language,
String stringFile)
Get all defined Strings from an app for the specified language and
strings filename
|
String |
getAppStrings()
Deprecated.
|
String |
getAppStrings(String language)
Deprecated.
|
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() |
String |
getDeviceTime() |
org.openqa.selenium.remote.ExecuteMethod |
getExecuteMethod() |
org.openqa.selenium.interactions.Mouse |
getMouse()
Deprecated.
|
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)
Deprecated.
|
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.
|
abstract RequiredElementType |
scrollTo(String text)
Scroll to an element which contains the given text.
|
abstract RequiredElementType |
scrollToExact(String text)
Scroll to an element with the given text.
|
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, getPageSource, getScreenshotAs, getSessionId, getTitle, getW3CStandardComplianceLevel, getWindowHandle, getWindowHandles, log, manage, navigate, quit, setCommandExecutor, setElementConverter, setErrorHandler, setFileDetector, setFoundBy, setLogLevel, setSessionId, startClient, startSession, startSession, stopClient, switchTo, toStringprotected final String KEY_CODE
protected final String PATH
public AppiumDriver(URL remoteAddress, org.openqa.selenium.Capabilities desiredCapabilities)
public AppiumDriver(URL remoteAddress, org.openqa.selenium.remote.http.HttpClient.Factory httpClientFactory, org.openqa.selenium.Capabilities desiredCapabilities)
public AppiumDriver(AppiumDriverLocalService service, org.openqa.selenium.Capabilities desiredCapabilities)
public AppiumDriver(AppiumDriverLocalService service, org.openqa.selenium.remote.http.HttpClient.Factory httpClientFactory, org.openqa.selenium.Capabilities desiredCapabilities)
public AppiumDriver(AppiumServiceBuilder builder, org.openqa.selenium.Capabilities desiredCapabilities)
public AppiumDriver(AppiumServiceBuilder builder, org.openqa.selenium.remote.http.HttpClient.Factory httpClientFactory, org.openqa.selenium.Capabilities desiredCapabilities)
public AppiumDriver(org.openqa.selenium.remote.http.HttpClient.Factory httpClientFactory,
org.openqa.selenium.Capabilities desiredCapabilities)
public AppiumDriver(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 valuesImmutableMapprotected static boolean _isNotNullOrEmpty(String str)
str - String to check.protected static boolean _isNotNullOrEmpty(Object ob)
public 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 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 String getDeviceTime()
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 coordinateduration - how long between pressing down, and lifting fingers/appendagesTouchShortcuts.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 setting@Deprecated public void lockScreen(int seconds)
public 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)
@Deprecated public String getAppStrings()
@Deprecated public String getAppStrings(String language)
public Map<String,String> getAppStringMap()
HasAppStringsHasAppStrings.getAppStringMap()public Map<String,String> getAppStringMap(String language)
HasAppStringslanguage - strings language codeHasAppStrings.getAppStringMap(String)public Map<String,String> getAppStringMap(String language, String stringFile)
HasAppStringslanguage - strings language codestringFile - strings filenameHasAppStrings.getAppStringMap(String, String)public URL getRemoteAddress()
public abstract RequiredElementType scrollTo(String text)
ScrollsTotext - description or text of an element scroll topublic abstract RequiredElementType scrollToExact(String text)
ScrollsTotext - description or text of an element scroll topublic 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.