Class AppiumDriver

java.lang.Object
org.openqa.selenium.remote.RemoteWebDriver
io.appium.java_client.AppiumDriver
All Implemented Interfaces:
CanRememberExtensionPresence, ComparesImages, ExecutesDriverScript, ExecutesMethod, HasBrowserCheck, HasSettings, LogsEvents, org.openqa.selenium.bidi.HasBiDi, org.openqa.selenium.federatedcredentialmanagement.HasFederatedCredentialManagement, org.openqa.selenium.HasCapabilities, org.openqa.selenium.HasDownloads, org.openqa.selenium.interactions.Interactive, org.openqa.selenium.JavascriptExecutor, org.openqa.selenium.PrintsPage, org.openqa.selenium.SearchContext, org.openqa.selenium.TakesScreenshot, org.openqa.selenium.virtualauthenticator.HasVirtualAuthenticator, org.openqa.selenium.WebDriver
Direct Known Subclasses:
AndroidDriver, ChromiumDriver, GeckoDriver, IOSDriver, Mac2Driver, SafariDriver, WindowsDriver

public class AppiumDriver extends org.openqa.selenium.remote.RemoteWebDriver implements ExecutesMethod, ComparesImages, ExecutesDriverScript, LogsEvents, HasBrowserCheck, CanRememberExtensionPresence, HasSettings, org.openqa.selenium.bidi.HasBiDi
Default Appium driver implementation.
  • Nested Class Summary

    Nested classes/interfaces inherited from class org.openqa.selenium.remote.RemoteWebDriver

    org.openqa.selenium.remote.RemoteWebDriver.RemoteTargetLocator, org.openqa.selenium.remote.RemoteWebDriver.RemoteWebDriverOptions, org.openqa.selenium.remote.RemoteWebDriver.When

    Nested classes/interfaces inherited from interface org.openqa.selenium.HasDownloads

    org.openqa.selenium.HasDownloads.DownloadedFile

    Nested classes/interfaces inherited from interface org.openqa.selenium.WebDriver

    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
  • Field Summary

    Fields inherited from class org.openqa.selenium.remote.RemoteWebDriver

    capabilities

    Fields inherited from interface io.appium.java_client.HasBrowserCheck

    NATIVE_CONTEXT
  • Constructor Summary

    Constructors
    Constructor
    Description
    AppiumDriver(AppiumClientConfig clientConfig, org.openqa.selenium.Capabilities capabilities)
     
    AppiumDriver(AppiumDriverLocalService service, org.openqa.selenium.Capabilities capabilities)
     
    AppiumDriver(AppiumDriverLocalService service, org.openqa.selenium.remote.http.HttpClient.Factory httpClientFactory, org.openqa.selenium.Capabilities capabilities)
     
    AppiumDriver(AppiumServiceBuilder builder, org.openqa.selenium.Capabilities capabilities)
     
    AppiumDriver(AppiumServiceBuilder builder, org.openqa.selenium.remote.http.HttpClient.Factory httpClientFactory, org.openqa.selenium.Capabilities capabilities)
     
    AppiumDriver(URL remoteSessionAddress, String platformName, String automationName)
    This is a special constructor used to connect to a running driver instance.
    AppiumDriver(URL remoteAddress, org.openqa.selenium.Capabilities capabilities)
     
    AppiumDriver(URL remoteAddress, org.openqa.selenium.remote.http.HttpClient.Factory httpClientFactory, org.openqa.selenium.Capabilities capabilities)
     
    AppiumDriver(org.openqa.selenium.Capabilities capabilities)
     
    AppiumDriver(org.openqa.selenium.remote.http.HttpClient.Factory httpClientFactory, org.openqa.selenium.Capabilities capabilities)
     
    AppiumDriver(org.openqa.selenium.remote.HttpCommandExecutor executor, org.openqa.selenium.Capabilities capabilities)
    Creates a new instance based on command executor and capabilities.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addCommand(org.openqa.selenium.remote.http.HttpMethod httpMethod, String url, String methodName)
    This method is used to add custom appium commands in Appium 2.0.
    Verifies if the given extension is not present in the list of absent extensions for the given driver instance.
    protected static org.openqa.selenium.Capabilities
    ensureAutomationName(org.openqa.selenium.Capabilities originalCapabilities, String defaultName)
    Changes automation name if it is not set and returns merged capabilities.
    protected static org.openqa.selenium.Capabilities
    ensurePlatformAndAutomationNames(org.openqa.selenium.Capabilities originalCapabilities, String defaultPlatformName, String defaultAutomationName)
    Changes platform and automation names if they are not set and returns merged capabilities.
    protected static org.openqa.selenium.Capabilities
    ensurePlatformName(org.openqa.selenium.Capabilities originalCapabilities, String defaultName)
    Changes platform name if it is not set and returns merged capabilities.
    org.openqa.selenium.remote.Response
    execute(String command)
    Executes the given command and returns a response.
    org.openqa.selenium.remote.Response
    execute(String driverCommand, Map<String,?> parameters)
    Executes the given command and returns a response.
    @NonNull org.openqa.selenium.bidi.BiDi
     
    org.openqa.selenium.remote.ExecuteMethod
     
    protected org.openqa.selenium.remote.http.HttpClient
     
    <X> X
    getScreenshotAs(org.openqa.selenium.OutputType<X> outputType)
     
    This method is used to get build version status of running Appium server.
    Marks the given extension as absent for the given driver instance.
    Optional<org.openqa.selenium.bidi.BiDi>
     
    protected void
    startSession(org.openqa.selenium.Capabilities requestCapabilities)
     

    Methods inherited from class org.openqa.selenium.remote.RemoteWebDriver

    addVirtualAuthenticator, builder, close, deleteDownloadableFiles, downloadFile, execute, executeAsyncScript, executeScript, findElement, findElements, findElements, fireSessionEvent, fireSessionEvent, get, getCapabilities, getClientConfig, getCommandExecutor, getCurrentUrl, getDownloadableFiles, getDownloadedFiles, getElementConverter, getErrorHandler, getFederatedCredentialManagementDialog, getFileDetector, getPageSource, getSessionId, getTitle, getWindowHandle, getWindowHandles, isDownloadsEnabled, log, manage, navigate, network, perform, print, quit, removeVirtualAuthenticator, resetCooldown, resetInputState, script, setCommandExecutor, setDelayEnabled, setElementConverter, setErrorHandler, setFileDetector, setFoundBy, setLogLevel, setSessionId, switchTo, toString

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

    Methods inherited from interface io.appium.java_client.ExecutesDriverScript

    executeDriverScript, executeDriverScript

    Methods inherited from interface io.appium.java_client.HasBrowserCheck

    isBrowser

    Methods inherited from interface org.openqa.selenium.HasCapabilities

    getCapabilities

    Methods inherited from interface org.openqa.selenium.HasDownloads

    requireDownloadsEnabled

    Methods inherited from interface io.appium.java_client.HasSettings

    getSettings, setSetting, setSetting, setSettings, setSettings

    Methods inherited from interface org.openqa.selenium.JavascriptExecutor

    executeScript, getPinnedScripts, pin, unpin

    Methods inherited from interface io.appium.java_client.LogsEvents

    getEvents, logEvent
  • Constructor Details

    • AppiumDriver

      public AppiumDriver(org.openqa.selenium.remote.HttpCommandExecutor executor, org.openqa.selenium.Capabilities capabilities)
      Creates a new instance based on command executor and capabilities.
      Parameters:
      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
    • AppiumDriver

      public AppiumDriver(AppiumClientConfig clientConfig, org.openqa.selenium.Capabilities capabilities)
    • AppiumDriver

      public AppiumDriver(URL remoteAddress, org.openqa.selenium.Capabilities capabilities)
    • AppiumDriver

      public AppiumDriver(URL remoteAddress, org.openqa.selenium.remote.http.HttpClient.Factory httpClientFactory, org.openqa.selenium.Capabilities capabilities)
    • AppiumDriver

      public AppiumDriver(AppiumDriverLocalService service, org.openqa.selenium.Capabilities capabilities)
    • AppiumDriver

      public AppiumDriver(AppiumDriverLocalService service, org.openqa.selenium.remote.http.HttpClient.Factory httpClientFactory, org.openqa.selenium.Capabilities capabilities)
    • AppiumDriver

      public AppiumDriver(AppiumServiceBuilder builder, org.openqa.selenium.Capabilities capabilities)
    • AppiumDriver

      public AppiumDriver(AppiumServiceBuilder builder, org.openqa.selenium.remote.http.HttpClient.Factory httpClientFactory, org.openqa.selenium.Capabilities capabilities)
    • AppiumDriver

      public AppiumDriver(org.openqa.selenium.remote.http.HttpClient.Factory httpClientFactory, org.openqa.selenium.Capabilities capabilities)
    • AppiumDriver

      public AppiumDriver(org.openqa.selenium.Capabilities capabilities)
    • AppiumDriver

      public AppiumDriver(URL remoteSessionAddress, String platformName, String automationName)
      This is a special constructor used to connect to a running driver instance. It does not do any necessary verifications, but rather assumes the given driver session is already running at `remoteSessionAddress`. The maintenance of driver state(s) is the caller's responsibility. !!! This API is supposed to be used for **debugging purposes only**.
      Parameters:
      remoteSessionAddress - The address of the **running** session including the session identifier.
      platformName - The name of the target platform.
      automationName - The name of the target automation.
  • Method Details

    • getExecuteMethod

      public org.openqa.selenium.remote.ExecuteMethod getExecuteMethod()
      Overrides:
      getExecuteMethod in class org.openqa.selenium.remote.RemoteWebDriver
    • getStatus

      public Map<String,Object> getStatus()
      This method is used to get build version status of running Appium server.
      Returns:
      map containing version details
    • addCommand

      public void addCommand(org.openqa.selenium.remote.http.HttpMethod httpMethod, String url, String methodName)
      This method is used to add custom appium commands in Appium 2.0.
      Parameters:
      httpMethod - the available HttpMethod.
      url - The url to URL template as https://www.w3.org/TR/webdriver/#endpoints.
      methodName - The name of custom appium command.
    • execute

      public org.openqa.selenium.remote.Response execute(String driverCommand, Map<String,?> parameters)
      Description copied from interface: ExecutesMethod
      Executes the given command and returns a response.
      Specified by:
      execute in interface ExecutesMethod
      Overrides:
      execute in class org.openqa.selenium.remote.RemoteWebDriver
      Parameters:
      driverCommand - a command to execute
      parameters - map of command parameters
      Returns:
      a result response
    • execute

      public org.openqa.selenium.remote.Response execute(String command)
      Description copied from interface: ExecutesMethod
      Executes the given command and returns a response.
      Specified by:
      execute in interface ExecutesMethod
      Overrides:
      execute in class org.openqa.selenium.remote.RemoteWebDriver
      Parameters:
      command - a command to execute
      Returns:
      a result response
    • getScreenshotAs

      public <X> X getScreenshotAs(org.openqa.selenium.OutputType<X> outputType)
      Specified by:
      getScreenshotAs in interface org.openqa.selenium.TakesScreenshot
      Overrides:
      getScreenshotAs in class org.openqa.selenium.remote.RemoteWebDriver
    • assertExtensionExists

      public AppiumDriver assertExtensionExists(String extName)
      Description copied from interface: CanRememberExtensionPresence
      Verifies if the given extension is not present in the list of absent extensions for the given driver instance. This API is designed for private usage.
      Specified by:
      assertExtensionExists in interface CanRememberExtensionPresence
      Parameters:
      extName - extension name.
      Returns:
      self instance for chaining.
    • markExtensionAbsence

      public AppiumDriver markExtensionAbsence(String extName)
      Description copied from interface: CanRememberExtensionPresence
      Marks the given extension as absent for the given driver instance. This API is designed for private usage.
      Specified by:
      markExtensionAbsence in interface CanRememberExtensionPresence
      Parameters:
      extName - extension name.
      Returns:
      self instance for chaining.
    • maybeGetBiDi

      public Optional<org.openqa.selenium.bidi.BiDi> maybeGetBiDi()
      Specified by:
      maybeGetBiDi in interface org.openqa.selenium.bidi.HasBiDi
    • getBiDi

      public @NonNull org.openqa.selenium.bidi.BiDi getBiDi()
      Specified by:
      getBiDi in interface org.openqa.selenium.bidi.HasBiDi
    • getHttpClient

      protected org.openqa.selenium.remote.http.HttpClient getHttpClient()
    • startSession

      protected void startSession(org.openqa.selenium.Capabilities requestCapabilities)
      Overrides:
      startSession in class org.openqa.selenium.remote.RemoteWebDriver
    • ensurePlatformName

      protected static org.openqa.selenium.Capabilities ensurePlatformName(org.openqa.selenium.Capabilities originalCapabilities, String defaultName)
      Changes platform name if it is not set and returns merged capabilities.
      Parameters:
      originalCapabilities - the given Capabilities.
      defaultName - a platformName value which has to be set up
      Returns:
      Capabilities with changed platform name value or the original capabilities
    • ensureAutomationName

      protected static org.openqa.selenium.Capabilities ensureAutomationName(org.openqa.selenium.Capabilities originalCapabilities, String defaultName)
      Changes automation name if it is not set and returns merged capabilities.
      Parameters:
      originalCapabilities - the given Capabilities.
      defaultName - a platformName value which has to be set up
      Returns:
      Capabilities with changed mobile automation name value or the original capabilities
    • ensurePlatformAndAutomationNames

      protected static org.openqa.selenium.Capabilities ensurePlatformAndAutomationNames(org.openqa.selenium.Capabilities originalCapabilities, String defaultPlatformName, String defaultAutomationName)
      Changes platform and automation names if they are not set and returns merged capabilities.
      Parameters:
      originalCapabilities - the given Capabilities.
      defaultPlatformName - a platformName value which has to be set up
      defaultAutomationName - The default automation name to set up for this class
      Returns:
      Capabilities with changed platform/automation name value or the original capabilities