Class DriverCommandExecutor

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable, org.openqa.selenium.logging.NeedsLocalLogs, CommandExecutor

    public class DriverCommandExecutor
    extends HttpCommandExecutor
    implements java.io.Closeable
    A specialized HttpCommandExecutor that will use a DriverService that lives and dies with a single WebDriver session. The service will be restarted upon each new session request and shutdown after each quit command.
    • Constructor Detail

      • DriverCommandExecutor

        public DriverCommandExecutor​(DriverService service)
        Creates a new DriverCommandExecutor which will communicate with the driver as configured by the given service.
        Parameters:
        service - The DriverService to send commands to.
      • DriverCommandExecutor

        protected DriverCommandExecutor​(DriverService service,
                                        java.util.Map<java.lang.String,​CommandInfo> additionalCommands)
        Creates an DriverCommandExecutor that supports non-standard additionalCommands in addition to the standard.
        Parameters:
        service - driver server
        additionalCommands - additional commands the remote end can process
    • Method Detail

      • execute

        public Response execute​(Command command)
                         throws java.io.IOException
        Sends the command to the driver server for execution. The server will be started if requesting a new session. Likewise, if terminating a session, the server will be shutdown once a response is received.
        Specified by:
        execute in interface CommandExecutor
        Overrides:
        execute in class HttpCommandExecutor
        Parameters:
        command - The command to execute.
        Returns:
        The command response.
        Throws:
        java.io.IOException - If an I/O error occurs while sending the command.
      • close

        public void close()
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable