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

Direct Known Subclasses:
ChromeDriverService.Builder, EdgeDriverService.Builder, FirefoxDriverService.Builder, InternetExplorerDriverService.Builder, SafariDriverService.Builder, SafariTechPreviewDriverService.Builder
Enclosing class:

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.
      file - The executable to use.
      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.
      port - The port to use; must be non-negative.
      A self reference.
    • getPort

      protected int getPort()
    • usingAnyFreePort

      public B usingAnyFreePort()
      Configures the driver server to start on any available port.
      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.
      environment - A map of the environment variables to launch the server with.
      A self reference.
    • withLogFile

      public B withLogFile(File logFile)
      Configures the driver server to write log to the given file.
      logFile - A file to write log to.
      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.
      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.
      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)