Class AppiumServiceBuilder

java.lang.Object
org.openqa.selenium.remote.service.DriverService.Builder<AppiumDriverLocalService,AppiumServiceBuilder>
io.appium.java_client.service.local.AppiumServiceBuilder

public final class AppiumServiceBuilder extends org.openqa.selenium.remote.service.DriverService.Builder<AppiumDriverLocalService,AppiumServiceBuilder>
  • Field Details

    • APPIUM_PATH

      public static final String APPIUM_PATH
      The environmental variable used to define the path to executable appium.js (1.4.x and lower) or main.js (1.5.x and higher).
      See Also:
    • NODE_PATH

      public static final String NODE_PATH
      System property and environment variable name for the Node.js executable path (node.exe on Windows, node on Linux/macOS).
      See Also:
    • BROADCAST_IP4_ADDRESS

      public static final String BROADCAST_IP4_ADDRESS
      See Also:
    • BROADCAST_IP6_ADDRESS

      public static final String BROADCAST_IP6_ADDRESS
      See Also:
    • DEFAULT_APPIUM_PORT

      public static final int DEFAULT_APPIUM_PORT
      See Also:
  • Constructor Details

    • AppiumServiceBuilder

      public AppiumServiceBuilder()
  • Method Details

    • score

      public int score(org.openqa.selenium.Capabilities capabilities)
      Provides a measure of how strongly this DriverService supports the given capabilities. A score of 0 or less indicates that this DriverService does not support instances of WebDriver that require capabilities. Typically, the score is generated by summing the number of capabilities that the driver service directly supports that are unique to the driver service (that is, things like "proxy" don't tend to count to the score). Higher the score, higher the possibility of getting grid sessions created sooner.
      Specified by:
      score in class org.openqa.selenium.remote.service.DriverService.Builder<AppiumDriverLocalService,AppiumServiceBuilder>
    • findDefaultExecutable

      protected File findDefaultExecutable()
    • withArgument

      public AppiumServiceBuilder withArgument(ServerArgument argument)
      Boolean arguments have a special moment: the presence of an arguments means "true". This method was designed for these cases.
      Parameters:
      argument - is an instance which contains the argument name.
      Returns:
      the self-reference.
    • withArgument

      public AppiumServiceBuilder withArgument(ServerArgument argument, String value)
      Adds a server argument.
      Parameters:
      argument - is an instance which contains the argument name.
      value - A non null string value. (Warn!!!) Boolean arguments have a special moment: the presence of an arguments means "true". At this case an empty string should be defined.
      Returns:
      the self-reference.
    • withCapabilities

      public AppiumServiceBuilder withCapabilities(org.openqa.selenium.Capabilities capabilities)
      Adds capabilities.
      Parameters:
      capabilities - is an instance of Capabilities.
      Returns:
      the self-reference.
    • withCapabilities

      public AppiumServiceBuilder withCapabilities(org.openqa.selenium.Capabilities capabilities, boolean autoQuoteCapabilitiesOnWindows)
      Adds capabilities.
      Parameters:
      capabilities - is an instance of Capabilities.
      autoQuoteCapabilitiesOnWindows - automatically escape quote all capabilities when calling appium. This is required on windows systems only.
      Returns:
      the self-reference.
    • withAppiumJS

      public AppiumServiceBuilder withAppiumJS(File appiumJS)
      Sets an executable appium.js.
      Parameters:
      appiumJS - an executable appium.js (1.4.x and lower) or main.js (1.5.x and higher).
      Returns:
      the self-reference.
    • withIPAddress

      public AppiumServiceBuilder withIPAddress(String ipAddress)
    • createArgs

      protected List<String> createArgs()
      Specified by:
      createArgs in class org.openqa.selenium.remote.service.DriverService.Builder<AppiumDriverLocalService,AppiumServiceBuilder>
    • loadSystemProperties

      protected void loadSystemProperties()
      Specified by:
      loadSystemProperties in class org.openqa.selenium.remote.service.DriverService.Builder<AppiumDriverLocalService,AppiumServiceBuilder>
    • usingDriverExecutable

      public AppiumServiceBuilder usingDriverExecutable(File nodeJSExecutable)
      Sets which Node.js the builder will use.
      Overrides:
      usingDriverExecutable in class org.openqa.selenium.remote.service.DriverService.Builder<AppiumDriverLocalService,AppiumServiceBuilder>
      Parameters:
      nodeJSExecutable - The executable Node.js to use.
      Returns:
      A self reference.
    • usingPort

      public AppiumServiceBuilder usingPort(int port)
      Sets which port the appium server should be started on. A value of 0 indicates that any free port may be used.
      Overrides:
      usingPort in class org.openqa.selenium.remote.service.DriverService.Builder<AppiumDriverLocalService,AppiumServiceBuilder>
      Parameters:
      port - The port to use; must be non-negative.
      Returns:
      A self reference.
    • usingAnyFreePort

      public AppiumServiceBuilder usingAnyFreePort()
      Configures the appium server to start on any available port.
      Overrides:
      usingAnyFreePort in class org.openqa.selenium.remote.service.DriverService.Builder<AppiumDriverLocalService,AppiumServiceBuilder>
      Returns:
      A self reference.
    • withEnvironment

      public AppiumServiceBuilder withEnvironment(Map<String,String> environment)
      Defines the environment for the launched appium server.
      Overrides:
      withEnvironment in class org.openqa.selenium.remote.service.DriverService.Builder<AppiumDriverLocalService,AppiumServiceBuilder>
      Parameters:
      environment - A map of the environment variables to launch the appium server with.
      Returns:
      A self reference.
    • withLogFile

      public AppiumServiceBuilder withLogFile(File logFile)
      Configures the appium server to write log to the given file.
      Overrides:
      withLogFile in class org.openqa.selenium.remote.service.DriverService.Builder<AppiumDriverLocalService,AppiumServiceBuilder>
      Parameters:
      logFile - A file to write log to.
      Returns:
      A self reference.
    • createDriverService

      protected AppiumDriverLocalService createDriverService(File nodeJSExecutable, int nodeJSPort, Duration startupTimeout, List<String> nodeArguments, Map<String,String> nodeEnvironment)
      Specified by:
      createDriverService in class org.openqa.selenium.remote.service.DriverService.Builder<AppiumDriverLocalService,AppiumServiceBuilder>