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
and its subclasses that designed
specifically for each target mobile OS (still Android and iOS)public class AppiumDriver<T extends WebElement> extends org.openqa.selenium.remote.RemoteWebDriver implements ComparesImages
org.openqa.selenium.remote.RemoteWebDriver.RemoteTargetLocator, org.openqa.selenium.remote.RemoteWebDriver.RemoteWebDriverOptions, org.openqa.selenium.remote.RemoteWebDriver.When
WebDriver.ImeHandler, WebDriver.Navigation, WebDriver.Options, WebDriver.TargetLocator, WebDriver.Timeouts, WebDriver.Window
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(org.openqa.selenium.remote.HttpCommandExecutor executor,
org.openqa.selenium.Capabilities capabilities)
Creates a new instance based on command
executor and capabilities . |
AppiumDriver(java.net.URL remoteAddress,
org.openqa.selenium.Capabilities desiredCapabilities) |
AppiumDriver(java.net.URL remoteAddress,
org.openqa.selenium.remote.http.HttpClient.Factory httpClientFactory,
org.openqa.selenium.Capabilities desiredCapabilities) |
Modifier and Type | Method and Description |
---|---|
WebDriver |
context(java.lang.String name) |
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) |
java.util.List<T> |
findElements(org.openqa.selenium.By by)
Find all elements within the current page using the given mechanism.
|
java.util.List<T> |
findElements(java.lang.String by,
java.lang.String using)
Method performs the searching for a list of elements by some selector defined by string
and value of the given selector.
|
java.util.List<T> |
findElementsByAccessibilityId(java.lang.String using)
Method performs the searching for a list of elements by accessibility ID selector
and value of the given selector.
|
java.util.List<T> |
findElementsByClassName(java.lang.String using) |
java.util.List<T> |
findElementsByCssSelector(java.lang.String using)
Finds many elements by CSS selector.
|
java.util.List<T> |
findElementsById(java.lang.String id) |
java.util.List<T> |
findElementsByLinkText(java.lang.String using)
Finds many elements by link text.
|
java.util.List<T> |
findElementsByName(java.lang.String using) |
java.util.List<T> |
findElementsByPartialLinkText(java.lang.String using)
Finds many elements by partial link text.
|
java.util.List<T> |
findElementsByTagName(java.lang.String using) |
java.util.List<T> |
findElementsByXPath(java.lang.String using) |
java.lang.String |
getContext() |
java.util.Set<java.lang.String> |
getContextHandles() |
org.openqa.selenium.remote.ExecuteMethod |
getExecuteMethod() |
org.openqa.selenium.interactions.Mouse |
getMouse()
Deprecated.
|
org.openqa.selenium.ScreenOrientation |
getOrientation() |
java.net.URL |
getRemoteAddress() |
boolean |
isBrowser()
Checks if focus is on browser.
|
org.openqa.selenium.html5.Location |
location() |
void |
rotate(org.openqa.selenium.DeviceRotation rotation) |
void |
rotate(org.openqa.selenium.ScreenOrientation orientation) |
org.openqa.selenium.DeviceRotation |
rotation() |
void |
setLocation(org.openqa.selenium.html5.Location location) |
protected static org.openqa.selenium.Capabilities |
substituteMobilePlatform(org.openqa.selenium.Capabilities originalCapabilities,
java.lang.String newPlatform)
Changes platform name and returns new capabilities.
|
java.lang.String |
toString() |
close, executeAsyncScript, executeScript, get, getCapabilities, getCommandExecutor, getCurrentUrl, getElementConverter, getErrorHandler, getFileDetector, getKeyboard, getPageSource, getScreenshotAs, getSessionId, getTitle, getWindowHandle, getWindowHandles, log, manage, navigate, perform, quit, resetInputState, setCommandExecutor, setElementConverter, setErrorHandler, setFileDetector, setFoundBy, setLogLevel, setSessionId, startSession, switchTo
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
findImageOccurrence, findImageOccurrence, findImageOccurrence, findImageOccurrence, getImagesSimilarity, getImagesSimilarity, getImagesSimilarity, getImagesSimilarity, matchImagesFeatures, matchImagesFeatures, matchImagesFeatures, matchImagesFeatures
execute, execute
close, get, getCurrentUrl, getPageSource, getTitle, getWindowHandle, getWindowHandles, manage, navigate, quit, switchTo
performMultiTouchAction, performTouchAction
findElementByAccessibilityId
hideKeyboard
getDeviceTime, getDeviceTime
pullFile, pullFolder
activateApp, activateApp, closeApp, installApp, installApp, isAppInstalled, launchApp, queryAppState, removeApp, removeApp, resetApp, runAppInBackground, terminateApp, terminateApp
getAppStringMap, getAppStringMap, getAppStringMap
getAutomationName, getPlatformName, getSessionDetail, getSessionDetails
public AppiumDriver(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 Capabilities
public AppiumDriver(java.net.URL remoteAddress, org.openqa.selenium.Capabilities desiredCapabilities)
public AppiumDriver(java.net.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, java.lang.String newPlatform)
originalCapabilities
- the given Capabilities
.newPlatform
- a CapabilityType.PLATFORM_NAME
value which has
to be set upCapabilities
with changed mobile platform valuepublic java.util.List<T> findElements(org.openqa.selenium.By by)
WebDriver
findElements
in interface MobileDriver<T extends WebElement>
findElements
in interface SearchContext
findElements
in interface WebDriver
by
- The locating mechanism to useWebElement
s, or an empty list if nothing matchesBy
,
WebDriver.Timeouts
public java.util.List<T> findElements(java.lang.String by, java.lang.String using)
FindsByFluentSelector
findElements
in interface FindsByFluentSelector<T extends WebElement>
by
- is a string selectorusing
- is a value of the given selectorpublic java.util.List<T> findElementsById(java.lang.String id)
findElementsById
in interface MobileDriver<T extends WebElement>
findElementsById
in interface FindsById
public java.util.List<T> findElementsByLinkText(java.lang.String using)
findElementsByLinkText
in interface MobileDriver<T extends WebElement>
findElementsByLinkText
in interface FindsByLinkText
public java.util.List<T> findElementsByPartialLinkText(java.lang.String using)
findElementsByPartialLinkText
in interface MobileDriver<T extends WebElement>
findElementsByPartialLinkText
in interface FindsByLinkText
public java.util.List<T> findElementsByTagName(java.lang.String using)
findElementsByTagName
in interface MobileDriver<T extends WebElement>
findElementsByTagName
in interface FindsByTagName
public java.util.List<T> findElementsByName(java.lang.String using)
findElementsByName
in interface MobileDriver<T extends WebElement>
findElementsByName
in interface FindsByName
public java.util.List<T> findElementsByClassName(java.lang.String using)
findElementsByClassName
in interface MobileDriver<T extends WebElement>
findElementsByClassName
in interface FindsByClassName
public java.util.List<T> findElementsByCssSelector(java.lang.String using)
findElementsByCssSelector
in interface MobileDriver<T extends WebElement>
findElementsByCssSelector
in interface FindsByCssSelector
public java.util.List<T> findElementsByXPath(java.lang.String using)
findElementsByXPath
in interface MobileDriver<T extends WebElement>
findElementsByXPath
in interface FindsByXPath
public java.util.List<T> findElementsByAccessibilityId(java.lang.String using)
FindsByAccessibilityId
findElementsByAccessibilityId
in interface FindsByAccessibilityId<T extends WebElement>
using
- an accessibility ID selectorpublic org.openqa.selenium.remote.ExecuteMethod getExecuteMethod()
getExecuteMethod
in class org.openqa.selenium.remote.RemoteWebDriver
public WebDriver context(java.lang.String name)
context
in interface org.openqa.selenium.ContextAware
public java.util.Set<java.lang.String> getContextHandles()
getContextHandles
in interface org.openqa.selenium.ContextAware
public java.lang.String getContext()
getContext
in interface org.openqa.selenium.ContextAware
public org.openqa.selenium.DeviceRotation rotation()
rotation
in interface org.openqa.selenium.Rotatable
public void rotate(org.openqa.selenium.DeviceRotation rotation)
rotate
in interface org.openqa.selenium.Rotatable
public void rotate(org.openqa.selenium.ScreenOrientation orientation)
rotate
in interface org.openqa.selenium.Rotatable
public org.openqa.selenium.ScreenOrientation getOrientation()
getOrientation
in interface org.openqa.selenium.Rotatable
public org.openqa.selenium.html5.Location location()
location
in interface org.openqa.selenium.html5.LocationContext
public void setLocation(org.openqa.selenium.html5.Location location)
setLocation
in interface org.openqa.selenium.html5.LocationContext
public java.net.URL getRemoteAddress()
public boolean isBrowser()
HasSessionDetails
isBrowser
in interface HasSessionDetails
public org.openqa.selenium.remote.Response execute(java.lang.String driverCommand, java.util.Map<java.lang.String,?> parameters)
ExecutesMethod
execute
in interface ExecutesMethod
execute
in class org.openqa.selenium.remote.RemoteWebDriver
driverCommand
- a JSONWP commandparameters
- map of command parameterspublic org.openqa.selenium.remote.Response execute(java.lang.String command)
ExecutesMethod
execute
in interface ExecutesMethod
execute
in class org.openqa.selenium.remote.RemoteWebDriver
command
- a JSONWP commandpublic T findElement(org.openqa.selenium.By by)
WebDriver
WebElement
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 SearchContext
findElement
in interface WebDriver
findElement
in class org.openqa.selenium.remote.RemoteWebDriver
by
- The locating mechanismBy
,
WebDriver.Timeouts
public T findElement(java.lang.String by, java.lang.String using)
FindsByFluentSelector
findElement
in interface FindsByFluentSelector<T extends WebElement>
findElement
in class org.openqa.selenium.remote.RemoteWebDriver
by
- 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 FindsById
findElementById
in class org.openqa.selenium.remote.RemoteWebDriver
public T findElementByLinkText(java.lang.String using) throws org.openqa.selenium.WebDriverException
findElementByLinkText
in interface MobileDriver<T extends WebElement>
findElementByLinkText
in interface FindsByLinkText
findElementByLinkText
in class org.openqa.selenium.remote.RemoteWebDriver
org.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 FindsByLinkText
findElementByPartialLinkText
in class org.openqa.selenium.remote.RemoteWebDriver
org.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 FindsByTagName
findElementByTagName
in class org.openqa.selenium.remote.RemoteWebDriver
public T findElementByName(java.lang.String using)
findElementByName
in interface MobileDriver<T extends WebElement>
findElementByName
in interface FindsByName
findElementByName
in class org.openqa.selenium.remote.RemoteWebDriver
public T findElementByClassName(java.lang.String using)
findElementByClassName
in interface MobileDriver<T extends WebElement>
findElementByClassName
in interface FindsByClassName
findElementByClassName
in class org.openqa.selenium.remote.RemoteWebDriver
public T findElementByCssSelector(java.lang.String using) throws org.openqa.selenium.WebDriverException
findElementByCssSelector
in interface MobileDriver<T extends WebElement>
findElementByCssSelector
in interface FindsByCssSelector
findElementByCssSelector
in class org.openqa.selenium.remote.RemoteWebDriver
org.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 FindsByXPath
findElementByXPath
in class org.openqa.selenium.remote.RemoteWebDriver
@Deprecated public org.openqa.selenium.interactions.Mouse getMouse()
getMouse
in interface org.openqa.selenium.interactions.HasInputDevices
getMouse
in class org.openqa.selenium.remote.RemoteWebDriver
public java.lang.String toString()
toString
in class org.openqa.selenium.remote.RemoteWebDriver