Class AppiumServiceBuilder

    • Field Detail

      • APPIUM_PATH

        public static final java.lang.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:
        Constant Field Values
      • BROADCAST_IP_ADDRESS

        public static final java.lang.String BROADCAST_IP_ADDRESS
        See Also:
        Constant Field Values
    • Constructor Detail

      • AppiumServiceBuilder

        public AppiumServiceBuilder()
    • Method Detail

      • 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 java.io.File findDefaultExecutable()
        Specified by:
        findDefaultExecutable in class org.openqa.selenium.remote.service.DriverService.Builder<AppiumDriverLocalService,​AppiumServiceBuilder>
      • 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,
                                                 java.lang.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​(java.io.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.
      • createArgs

        protected com.google.common.collect.ImmutableList<java.lang.String> createArgs()
        Specified by:
        createArgs in class org.openqa.selenium.remote.service.DriverService.Builder<AppiumDriverLocalService,​AppiumServiceBuilder>
      • usingDriverExecutable

        public AppiumServiceBuilder usingDriverExecutable​(java.io.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.
      • withEnvironment

        public AppiumServiceBuilder withEnvironment​(java.util.Map<java.lang.String,​java.lang.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​(java.io.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​(java.io.File nodeJSExecutable,
                                                               int nodeJSPort,
                                                               java.time.Duration startupTimeout,
                                                               java.util.List<java.lang.String> nodeArguments,
                                                               java.util.Map<java.lang.String,​java.lang.String> nodeEnvironment)
        Specified by:
        createDriverService in class org.openqa.selenium.remote.service.DriverService.Builder<AppiumDriverLocalService,​AppiumServiceBuilder>