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 Summary
Fields Modifier and Type Field Description static java.lang.StringAPPIUM_PATHThe environmental variable used to define the path to executable appium.js (1.4.x and lower) or main.js (1.5.x and higher).static java.lang.StringBROADCAST_IP_ADDRESSstatic intDEFAULT_APPIUM_PORT
-
Constructor Summary
Constructors Constructor Description AppiumServiceBuilder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected com.google.common.collect.ImmutableList<java.lang.String>createArgs()protected AppiumDriverLocalServicecreateDriverService(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)protected java.io.FilefindDefaultExecutable()intscore(org.openqa.selenium.Capabilities capabilities)Provides a measure of how strongly thisDriverServicesupports the givencapabilities.AppiumServiceBuilderusingAnyFreePort()Configures the appium server to start on any available port.AppiumServiceBuilderusingDriverExecutable(java.io.File nodeJSExecutable)Sets which Node.js the builder will use.AppiumServiceBuilderusingPort(int port)Sets which port the appium server should be started on.AppiumServiceBuilderwithAppiumJS(java.io.File appiumJS)Sets an executable appium.js.AppiumServiceBuilderwithArgument(ServerArgument argument)Boolean arguments have a special moment: the presence of an arguments means "true".AppiumServiceBuilderwithArgument(ServerArgument argument, java.lang.String value)Adds a server argument.AppiumServiceBuilderwithCapabilities(org.openqa.selenium.Capabilities capabilities)Adds capabilities.AppiumServiceBuilderwithCapabilities(org.openqa.selenium.Capabilities capabilities, boolean autoQuoteCapabilitiesOnWindows)Adds capabilities.AppiumServiceBuilderwithEnvironment(java.util.Map<java.lang.String,java.lang.String> environment)Defines the environment for the launched appium server.AppiumServiceBuilderwithIPAddress(java.lang.String ipAddress)AppiumServiceBuilderwithLogFile(java.io.File logFile)Configures the appium server to write log to the given file.
-
-
-
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
-
DEFAULT_APPIUM_PORT
public static final int DEFAULT_APPIUM_PORT
- See Also:
- Constant Field Values
-
-
Method Detail
-
score
public int score(org.openqa.selenium.Capabilities capabilities)
Provides a measure of how strongly thisDriverServicesupports the givencapabilities. A score of 0 or less indicates that thisDriverServicedoes not support instances ofWebDriverthat requirecapabilities. 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:
scorein classorg.openqa.selenium.remote.service.DriverService.Builder<AppiumDriverLocalService,AppiumServiceBuilder>
-
findDefaultExecutable
protected java.io.File findDefaultExecutable()
- Specified by:
findDefaultExecutablein classorg.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 ofCapabilities.- Returns:
- the self-reference.
-
withCapabilities
public AppiumServiceBuilder withCapabilities(org.openqa.selenium.Capabilities capabilities, boolean autoQuoteCapabilitiesOnWindows)
Adds capabilities.- Parameters:
capabilities- is an instance ofCapabilities.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.
-
withIPAddress
public AppiumServiceBuilder withIPAddress(java.lang.String ipAddress)
-
createArgs
protected com.google.common.collect.ImmutableList<java.lang.String> createArgs()
- Specified by:
createArgsin classorg.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:
usingDriverExecutablein classorg.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:
usingPortin classorg.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:
usingAnyFreePortin classorg.openqa.selenium.remote.service.DriverService.Builder<AppiumDriverLocalService,AppiumServiceBuilder>- 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:
withEnvironmentin classorg.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:
withLogFilein classorg.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:
createDriverServicein classorg.openqa.selenium.remote.service.DriverService.Builder<AppiumDriverLocalService,AppiumServiceBuilder>
-
-