Class DriverService.Builder<DS extends DriverService,B extends DriverService.Builder<?,?>>
java.lang.Object
org.openqa.selenium.remote.service.DriverService.Builder<DS,B>
- Enclosing class:
- DriverService
public abstract static class DriverService.Builder<DS extends DriverService,B extends DriverService.Builder<?,?>>
extends Object
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()
Creates a new service to manage the driver server.protected abstract DS
createDriverService
(File exe, int port, Duration timeout, List<String> args, Map<String, String> environment) protected Duration
protected File
protected OutputStream
protected int
getPort()
protected abstract void
protected void
parseLogOutput
(String logProperty) abstract int
score
(org.openqa.selenium.Capabilities capabilities) Provides a measure of how strongly thisDriverService
supports the givencapabilities
.Configures the driver server to start on any available port.usingDriverExecutable
(File file) Sets which driver executable the builder will use.usingPort
(int port) Sets which port the driver server should be started on.withEnvironment
(Map<String, String> environment) Defines the environment for the launched driver server.withLogFile
(File logFile) Configures the driver server to write log to the given file.withLogOutput
(OutputStream output) withTimeout
(Duration timeout) Configures the timeout waiting for driver server to start.
-
Field Details
-
exe
-
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
score
public abstract int score(org.openqa.selenium.Capabilities capabilities) Provides a measure of how strongly thisDriverService
supports the givencapabilities
. A score of 0 or less indicates that thisDriverService
does not support instances ofWebDriver
that 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). -
usingDriverExecutable
Sets which driver executable the builder will use.- Parameters:
file
- The executable to use.- Returns:
- A self reference.
-
usingPort
Sets which port the driver server should be started on. A value of 0 indicates that any free port may be used.- Parameters:
port
- The port to use; must be non-negative.- Returns:
- A self reference.
-
getPort
protected int getPort() -
usingAnyFreePort
Configures the driver server to start on any available port.- Returns:
- A self reference.
-
withEnvironment
Defines the environment for the launched driver server. These settings will be inherited by every browser session launched by the server.- Parameters:
environment
- A map of the environment variables to launch the server with.- Returns:
- A self reference.
-
withLogFile
Configures the driver server to write log to the given file.- Parameters:
logFile
- A file to write log to.- Returns:
- A self reference.
-
withLogOutput
-
getLogFile
-
withTimeout
Configures the timeout waiting for driver server to start.- Returns:
- A self reference.
-
getDefaultTimeout
-
getLogOutput
-
parseLogOutput
-
build
Creates a new service to manage the driver server. Before creating a new service, the builder will find a port for the server to listen to.- Returns:
- The new service object.
-
loadSystemProperties
protected abstract void loadSystemProperties() -
createArgs
-
createDriverService
-