Class DriverService.Builder<DS extends DriverService,B extends DriverService.Builder<?,?>>

java.lang.Object
org.openqa.selenium.remote.service.DriverService.Builder<DS,B>
Direct Known Subclasses:
ChromeDriverService.Builder, EdgeDriverService.Builder, FirefoxDriverService.Builder, InternetExplorerDriverService.Builder, SafariDriverService.Builder, SafariTechPreviewDriverService.Builder
Enclosing class:
DriverService

public abstract static class DriverService.Builder<DS extends DriverService,B extends DriverService.Builder<?,?>> extends Object
  • Constructor Details

    • Builder

      public Builder()
  • Method Details

    • score

      public abstract int score(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).
    • usingDriverExecutable

      public B usingDriverExecutable(File file)
      Sets which driver executable the builder will use.
      Parameters:
      file - The executable to use.
      Returns:
      A self reference.
    • usingPort

      public B usingPort(int port)
      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

      public B usingAnyFreePort()
      Configures the driver server to start on any available port.
      Returns:
      A self reference.
    • withEnvironment

      @Beta public B withEnvironment(Map<String,String> environment)
      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

      public B withLogFile(File logFile)
      Configures the driver server to write log to the given file.
      Parameters:
      logFile - A file to write log to.
      Returns:
      A self reference.
    • withLogOutput

      public B withLogOutput(OutputStream output)
    • getLogFile

      protected File getLogFile()
    • withTimeout

      public B withTimeout(Duration timeout)
      Configures the timeout waiting for driver server to start.
      Returns:
      A self reference.
    • getDefaultTimeout

      protected Duration getDefaultTimeout()
    • getLogOutput

      protected OutputStream getLogOutput()
    • parseLogOutput

      protected void parseLogOutput(String logProperty)
    • build

      public DS 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

      protected abstract List<String> createArgs()
    • createDriverService

      protected abstract DS createDriverService(File exe, int port, Duration timeout, List<String> args, Map<String,String> environment)