Class RemoteWebDriverBuilder

  • @Beta
    public class RemoteWebDriverBuilder
    extends java.lang.Object
    Create a new Selenium session using the W3C WebDriver protocol. This class will not generate any data expected by the original JSON Wire Protocol, so will fail to create sessions as expected if used against a server that only implements that protocol.

    Expected usage is something like:

       WebDriver driver = RemoteWebDriver.builder()
         .addAlternative(new FirefoxOptions())
         .addAlternative(new ChromeOptions())
         .addMetadata("cloud:key", "hunter2")
         .setCapability("proxy", new Proxy())
    In this example, we ask for a session where the browser will be either Firefox or Chrome (we don't care which), but where either browser will use the given Proxy. In addition, we've added some metadata to the session, setting the "cloud.key" to be the secret passphrase of our account with the cloud "Selenium as a Service" provider.

    If no call to withDriverService(DriverService) or address(URI) is made, the builder will use ServiceLoader to find all instances of WebDriverInfo and will call WebDriverInfo.createDriver(Capabilities) for the first supported set of capabilities.