T - the required type of class which implement WebElement.
Instances of the defined type will be returned via findElement* and findElements*.
Warning (!!!). Allowed types:
WebElement
RemoteWebElement
MobileElement
AndroidElementpublic class AndroidDriver<T extends WebElement> extends AppiumDriver<T> implements PressesKey, HasNetworkConnection, PushesFiles, StartsActivity, FindsByAndroidUIAutomator<T>, FindsByAndroidViewTag<T>, FindsByAndroidDataMatcher<T>, LocksDevice, HasAndroidDeviceDetails, HasSupportedPerformanceDataType, AuthenticatesByFinger, HasOnScreenKeyboard, CanRecordScreen, SupportsSpecialEmulatorCommands, SupportsNetworkStateManagement, ListensToLogcatMessages, HasAndroidClipboard, HasBattery<AndroidBatteryInfo>
org.openqa.selenium.remote.RemoteWebDriver.RemoteTargetLocator, org.openqa.selenium.remote.RemoteWebDriver.RemoteWebDriverOptions, org.openqa.selenium.remote.RemoteWebDriver.WhenWebDriver.ImeHandler, WebDriver.Navigation, WebDriver.Options, WebDriver.TargetLocator, WebDriver.Timeouts, WebDriver.Window| Constructor and Description |
|---|
AndroidDriver(AppiumDriverLocalService service,
org.openqa.selenium.Capabilities desiredCapabilities)
Creates a new instance based on Appium driver local service and
capabilities. |
AndroidDriver(AppiumDriverLocalService service,
org.openqa.selenium.remote.http.HttpClient.Factory httpClientFactory,
org.openqa.selenium.Capabilities desiredCapabilities)
Creates a new instance based on Appium driver local service, HTTP client factory and
capabilities. |
AndroidDriver(AppiumServiceBuilder builder,
org.openqa.selenium.Capabilities desiredCapabilities)
Creates a new instance based on Appium service builder and
capabilities. |
AndroidDriver(AppiumServiceBuilder builder,
org.openqa.selenium.remote.http.HttpClient.Factory httpClientFactory,
org.openqa.selenium.Capabilities desiredCapabilities)
Creates a new instance based on Appium service builder, HTTP client factory and
capabilities. |
AndroidDriver(org.openqa.selenium.Capabilities desiredCapabilities)
Creates a new instance based on
capabilities. |
AndroidDriver(org.openqa.selenium.remote.http.HttpClient.Factory httpClientFactory,
org.openqa.selenium.Capabilities desiredCapabilities)
Creates a new instance based on HTTP client factory and
capabilities. |
AndroidDriver(org.openqa.selenium.remote.HttpCommandExecutor executor,
org.openqa.selenium.Capabilities capabilities)
Creates a new instance based on command
executor and capabilities. |
AndroidDriver(java.net.URL remoteAddress,
org.openqa.selenium.Capabilities desiredCapabilities)
Creates a new instance based on Appium server URL and
capabilities. |
AndroidDriver(java.net.URL remoteAddress,
org.openqa.selenium.remote.http.HttpClient.Factory httpClientFactory,
org.openqa.selenium.Capabilities desiredCapabilities)
Creates a new instance based on Appium server URL, HTTP client factory and
capabilities. |
| Modifier and Type | Method and Description |
|---|---|
default io.appium.java_client.android.HasAndroidSettings |
allowInvisibleElements(boolean enabled)
Set whether the source output/xpath search should consider all elements, visible and invisible.
|
default io.appium.java_client.android.HasAndroidSettings |
configuratorSetActionAcknowledgmentTimeout(java.time.Duration timeout)
invoke
setActionAcknowledgmentTimeout in com.android.uiautomator.core.Configurator. |
default io.appium.java_client.android.HasAndroidSettings |
configuratorSetKeyInjectionDelay(java.time.Duration delay)
invoke
configuratorSetKeyInjectionDelay in com.android.uiautomator.core.Configurator. |
default io.appium.java_client.android.HasAndroidSettings |
configuratorSetScrollAcknowledgmentTimeout(java.time.Duration timeout)
invoke
setScrollAcknowledgmentTimeout in com.android.uiautomator.core.Configurator. |
default io.appium.java_client.android.HasAndroidSettings |
configuratorSetWaitForIdleTimeout(java.time.Duration timeout)
invoke
setWaitForIdleTimeout in com.android.uiautomator.core.Configurator. |
default io.appium.java_client.android.HasAndroidSettings |
configuratorSetWaitForSelectorTimeout(java.time.Duration timeout)
invoke
setWaitForSelectorTimeout in com.android.uiautomator.core.Configurator. |
default io.appium.java_client.android.HasAndroidSettings |
enableNotificationListener(boolean enabled)
Whether to enable or disable the notification listener.
|
void |
endTestCoverage(java.lang.String intent,
java.lang.String path)
Get test-coverage data.
|
org.openqa.selenium.remote.Response |
execute(java.lang.String command)
Executes JSONWP command and returns a response.
|
org.openqa.selenium.remote.Response |
execute(java.lang.String driverCommand,
java.util.Map<java.lang.String,?> parameters)
Executes JSONWP command and returns a response.
|
T |
findElement(org.openqa.selenium.By by)
Find the first
WebElement using the given method. |
T |
findElement(java.lang.String by,
java.lang.String using)
Method performs the searching for a single element by some selector defined by string
and value of the given selector.
|
T |
findElementByClassName(java.lang.String using) |
T |
findElementByCssSelector(java.lang.String using)
Finds a single element by CSS selector.
|
T |
findElementById(java.lang.String id) |
T |
findElementByLinkText(java.lang.String using)
Finds a single element by link text.
|
T |
findElementByName(java.lang.String using) |
T |
findElementByPartialLinkText(java.lang.String using)
Finds a single element by partial link text.
|
T |
findElementByTagName(java.lang.String using) |
T |
findElementByXPath(java.lang.String using) |
AndroidBatteryInfo |
getBatteryInfo()
Retrieves battery info from the device under test.
|
StringWebSocketClient |
getLogcatClient() |
default io.appium.java_client.android.HasAndroidSettings |
ignoreUnimportantViews(java.lang.Boolean compress)
Set the `ignoreUnimportantViews` setting.
|
default io.appium.java_client.android.HasAndroidSettings |
normalizeTagNames(boolean enabled)
Setting this value to true will enforce source tree dumper
to transliterate all class names used as XML tags to the limited
set of ASCII characters supported by Apache Harmony
lib and used by default in Android to avoid possible
XML parsing exceptions caused by XPath lookup.
|
void |
openNotifications()
Open the notification shade, on Android devices.
|
default io.appium.java_client.android.HasAndroidSettings |
setElementResponseAttributes(java.lang.String attrNames)
Which attributes should be returned if compact responses are disabled.
|
default io.appium.java_client.android.HasAndroidSettings |
setShouldUseCompactResponses(boolean enabled)
Whether to return compact (standards-compliant) and faster responses in find element/s
(the default setting).
|
default io.appium.java_client.android.HasAndroidSettings |
setTrackScrollEvents(boolean enabled)
Turn on or off the tracking of scroll events as they happen.
|
default io.appium.java_client.android.HasAndroidSettings |
shutdownOnPowerDisconnect(boolean enabled)
Whether to enable or disable shutdown the server through
the broadcast receiver on ACTION_POWER_DISCONNECTED.
|
void |
toggleLocationServices() |
java.lang.String |
toString() |
context, findElements, findElements, findElementsByAccessibilityId, findElementsByClassName, findElementsByCssSelector, findElementsById, findElementsByLinkText, findElementsByName, findElementsByPartialLinkText, findElementsByTagName, findElementsByXPath, getContext, getContextHandles, getExecuteMethod, getOrientation, getRemoteAddress, getStatus, isBrowser, location, rotate, rotate, rotation, setLocation, startSession, substituteMobilePlatform, updateDefaultPlatformNamebuilder, close, executeAsyncScript, executeScript, get, getCapabilities, getCommandExecutor, getCurrentUrl, getElementConverter, getErrorHandler, getFileDetector, getKeyboard, getMouse, getPageSource, getScreenshotAs, getSessionId, getTitle, getWindowHandle, getWindowHandles, log, manage, navigate, perform, quit, resetInputState, setCommandExecutor, setElementConverter, setErrorHandler, setFileDetector, setFoundBy, setLogLevel, setSessionId, switchToclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitlongPressKey, pressKeygetConnection, setConnectionpushFile, pushFilepullFile, pullFoldercurrentActivity, getCurrentPackage, startActivityfindElementByAndroidUIAutomator, findElementsByAndroidUIAutomatorfindElementByAndroidViewTag, findElementsByAndroidViewTagfindElementByAndroidDataMatcher, findElementsByAndroidDataMatcherfindElement, findElementsisDeviceLocked, lockDevice, lockDevice, unlockDevicegetSettings, setSettinggetDisplayDensity, getSystemBarsgetPerformanceData, getSupportedPerformanceDataTypesfingerPrintisKeyboardShownstartRecordingScreen, startRecordingScreen, stopRecordingScreen, stopRecordingScreenmakeGsmCall, sendSMS, setGsmSignalStrength, setGsmVoice, setNetworkSpeed, setPowerAC, setPowerCapacitytoggleAirplaneMode, toggleData, toggleWifiaddLogcatConnectionListener, addLogcatDisconnectionListener, addLogcatErrorsListener, addLogcatMessagesListener, removeAllLogcatListeners, startLogcatBroadcast, startLogcatBroadcast, startLogcatBroadcast, stopLogcatBroadcastsetClipboard, setClipboardTextgetClipboard, getClipboardText, setClipboard, setClipboardTextfindImageOccurrence, findImageOccurrence, findImageOccurrence, findImageOccurrence, getImagesSimilarity, getImagesSimilarity, getImagesSimilarity, getImagesSimilarity, matchImagesFeatures, matchImagesFeatures, matchImagesFeatures, matchImagesFeaturesfindElementByImage, findElementsByImagefindElementByCustom, findElementsByCustomexecuteDriverScript, executeDriverScriptclose, get, getCurrentUrl, getPageSource, getTitle, getWindowHandle, getWindowHandles, manage, navigate, quit, switchToperformMultiTouchAction, performTouchActionfindElementByAccessibilityIdhideKeyboardgetDeviceTime, getDeviceTimeactivateApp, activateApp, closeApp, installApp, installApp, isAppInstalled, launchApp, queryAppState, removeApp, removeApp, resetApp, runAppInBackground, terminateApp, terminateAppgetAppStringMap, getAppStringMap, getAppStringMapgetAllSessionDetails, getAutomationName, getPlatformName, getSessionDetail, getSessionDetailspublic AndroidDriver(org.openqa.selenium.remote.HttpCommandExecutor executor,
org.openqa.selenium.Capabilities capabilities)
executor and capabilities.executor - is an instance of HttpCommandExecutor
or class that extends it. Default commands or another vendor-specific
commands may be specified there.capabilities - take a look at Capabilitiespublic AndroidDriver(java.net.URL remoteAddress,
org.openqa.selenium.Capabilities desiredCapabilities)
capabilities.remoteAddress - is the address of remotely/locally started Appium serverdesiredCapabilities - take a look at Capabilitiespublic AndroidDriver(java.net.URL remoteAddress,
org.openqa.selenium.remote.http.HttpClient.Factory httpClientFactory,
org.openqa.selenium.Capabilities desiredCapabilities)
capabilities.remoteAddress - is the address of remotely/locally started Appium serverhttpClientFactory - take a look at HttpClient.FactorydesiredCapabilities - take a look at Capabilitiespublic AndroidDriver(AppiumDriverLocalService service, org.openqa.selenium.Capabilities desiredCapabilities)
capabilities.service - take a look at AppiumDriverLocalServicedesiredCapabilities - take a look at Capabilitiespublic AndroidDriver(AppiumDriverLocalService service, org.openqa.selenium.remote.http.HttpClient.Factory httpClientFactory, org.openqa.selenium.Capabilities desiredCapabilities)
capabilities.service - take a look at AppiumDriverLocalServicehttpClientFactory - take a look at HttpClient.FactorydesiredCapabilities - take a look at Capabilitiespublic AndroidDriver(AppiumServiceBuilder builder, org.openqa.selenium.Capabilities desiredCapabilities)
capabilities.builder - take a look at AppiumServiceBuilderdesiredCapabilities - take a look at Capabilitiespublic AndroidDriver(AppiumServiceBuilder builder, org.openqa.selenium.remote.http.HttpClient.Factory httpClientFactory, org.openqa.selenium.Capabilities desiredCapabilities)
capabilities.builder - take a look at AppiumServiceBuilderhttpClientFactory - take a look at HttpClient.FactorydesiredCapabilities - take a look at Capabilitiespublic AndroidDriver(org.openqa.selenium.remote.http.HttpClient.Factory httpClientFactory,
org.openqa.selenium.Capabilities desiredCapabilities)
capabilities.httpClientFactory - take a look at HttpClient.FactorydesiredCapabilities - take a look at Capabilitiespublic AndroidDriver(org.openqa.selenium.Capabilities desiredCapabilities)
capabilities.desiredCapabilities - take a look at Capabilitiespublic void endTestCoverage(java.lang.String intent,
java.lang.String path)
intent - intent to broadcast.path - path to .ec file.public void openNotifications()
public void toggleLocationServices()
public AndroidBatteryInfo getBatteryInfo()
HasBatterygetBatteryInfo in interface HasBattery<AndroidBatteryInfo>public StringWebSocketClient getLogcatClient()
getLogcatClient in interface ListensToLogcatMessagespublic io.appium.java_client.android.HasAndroidSettings ignoreUnimportantViews(java.lang.Boolean compress)
compress - ignores unimportant views if true, doesn't ignore otherwise.public io.appium.java_client.android.HasAndroidSettings configuratorSetWaitForIdleTimeout(java.time.Duration timeout)
setWaitForIdleTimeout in com.android.uiautomator.core.Configurator.timeout - A negative value would reset to its default value. Minimum time unit
resolution is one millisecondpublic io.appium.java_client.android.HasAndroidSettings configuratorSetWaitForSelectorTimeout(java.time.Duration timeout)
setWaitForSelectorTimeout in com.android.uiautomator.core.Configurator.timeout - A negative value would reset to its default value. Minimum time unit
resolution is one millisecondpublic io.appium.java_client.android.HasAndroidSettings configuratorSetScrollAcknowledgmentTimeout(java.time.Duration timeout)
setScrollAcknowledgmentTimeout in com.android.uiautomator.core.Configurator.timeout - A negative value would reset to its default value. Minimum time unit
resolution is one millisecondpublic io.appium.java_client.android.HasAndroidSettings configuratorSetKeyInjectionDelay(java.time.Duration delay)
configuratorSetKeyInjectionDelay in com.android.uiautomator.core.Configurator.delay - A negative value would reset to its default value. Minimum time unit
resolution is one millisecondpublic io.appium.java_client.android.HasAndroidSettings configuratorSetActionAcknowledgmentTimeout(java.time.Duration timeout)
setActionAcknowledgmentTimeout in com.android.uiautomator.core.Configurator.timeout - A negative value would reset to its default value. Minimum time unit
resolution is one millisecondpublic io.appium.java_client.android.HasAndroidSettings normalizeTagNames(boolean enabled)
enabled - Either true or false. The default value if false.public io.appium.java_client.android.HasAndroidSettings setShouldUseCompactResponses(boolean enabled)
enabled - Either true or false. The default value if true.public io.appium.java_client.android.HasAndroidSettings setElementResponseAttributes(java.lang.String attrNames)
attrNames - The comma-separated list of fields to return with each element.public io.appium.java_client.android.HasAndroidSettings allowInvisibleElements(boolean enabled)
enabled - Either true or false. The default value if false.public io.appium.java_client.android.HasAndroidSettings enableNotificationListener(boolean enabled)
enabled - Either true or false. The default value if true.public io.appium.java_client.android.HasAndroidSettings shutdownOnPowerDisconnect(boolean enabled)
enabled - Either true or false. The default value if true.public io.appium.java_client.android.HasAndroidSettings setTrackScrollEvents(boolean enabled)
true, a field lastScrollData is added to the results of
getSession, which can then be used to check on scroll progress.
Turning this feature off significantly increases touch action performance.enabled - Either true or false. The default value if true.public org.openqa.selenium.remote.Response execute(java.lang.String driverCommand,
java.util.Map<java.lang.String,?> parameters)
ExecutesMethodexecute in interface ExecutesMethodexecute in class org.openqa.selenium.remote.RemoteWebDriverdriverCommand - a JSONWP commandparameters - map of command parameterspublic org.openqa.selenium.remote.Response execute(java.lang.String command)
ExecutesMethodexecute in interface ExecutesMethodexecute in class org.openqa.selenium.remote.RemoteWebDrivercommand - a JSONWP commandpublic T findElement(org.openqa.selenium.By by)
WebDriverWebElement using the given method.
This method is affected by the 'implicit wait' times in force at the time of execution.
The findElement(..) invocation will return a matching row, or try again repeatedly until
the configured timeout is reached.
findElement should not be used to look for non-present elements, use WebDriver.findElements(By)
and assert zero length response instead.findElement in interface MobileDriver<T extends WebElement>findElement in interface SearchContextfindElement in interface WebDriverfindElement in class org.openqa.selenium.remote.RemoteWebDriverby - The locating mechanismBy,
WebDriver.Timeoutspublic T findElement(java.lang.String by,
java.lang.String using)
FindsByFluentSelectorfindElement in interface FindsByFluentSelector<T extends WebElement>findElement in class org.openqa.selenium.remote.RemoteWebDriverby - is a string selectorusing - is a value of the given selectorpublic T findElementById(java.lang.String id)
findElementById in interface MobileDriver<T extends WebElement>findElementById in interface FindsByIdfindElementById in class org.openqa.selenium.remote.RemoteWebDriverpublic T findElementByLinkText(java.lang.String using)
throws org.openqa.selenium.WebDriverException
findElementByLinkText in interface MobileDriver<T extends WebElement>findElementByLinkText in interface FindsByLinkTextfindElementByLinkText in class org.openqa.selenium.remote.RemoteWebDriverorg.openqa.selenium.WebDriverException - This method doesn't work against native app UI.public T findElementByPartialLinkText(java.lang.String using)
throws org.openqa.selenium.WebDriverException
findElementByPartialLinkText in interface MobileDriver<T extends WebElement>findElementByPartialLinkText in interface FindsByLinkTextfindElementByPartialLinkText in class org.openqa.selenium.remote.RemoteWebDriverorg.openqa.selenium.WebDriverException - This method doesn't work against native app UI.public T findElementByTagName(java.lang.String using)
findElementByTagName in interface MobileDriver<T extends WebElement>findElementByTagName in interface FindsByTagNamefindElementByTagName in class org.openqa.selenium.remote.RemoteWebDriverpublic T findElementByName(java.lang.String using)
findElementByName in interface MobileDriver<T extends WebElement>findElementByName in interface FindsByNamefindElementByName in class org.openqa.selenium.remote.RemoteWebDriverpublic T findElementByClassName(java.lang.String using)
findElementByClassName in interface MobileDriver<T extends WebElement>findElementByClassName in interface FindsByClassNamefindElementByClassName in class org.openqa.selenium.remote.RemoteWebDriverpublic T findElementByCssSelector(java.lang.String using)
throws org.openqa.selenium.WebDriverException
findElementByCssSelector in interface MobileDriver<T extends WebElement>findElementByCssSelector in interface FindsByCssSelectorfindElementByCssSelector in class org.openqa.selenium.remote.RemoteWebDriverorg.openqa.selenium.WebDriverException - This method doesn't work against native app UI.public T findElementByXPath(java.lang.String using)
findElementByXPath in interface MobileDriver<T extends WebElement>findElementByXPath in interface FindsByXPathfindElementByXPath in class org.openqa.selenium.remote.RemoteWebDriverpublic java.lang.String toString()
toString in class org.openqa.selenium.remote.RemoteWebDriver