Interface WebDriverProvider

@ParametersAreNonnullByDefault public interface WebDriverProvider

Interface for using custom WebDriver in your tests.

See for overview

To customize WebDriver creation one can use any of the alternatives:

  • Call method WebDriverRunner.setWebDriver(WebDriver) explicitly.
  • Extend DriverFactory implementation
  • Extend WebDriver implementation, override public XxxDriver(Capabilities capabilities) constructor and pass this class name as browser system variable value.
  • Implement this very interface and pass the implementation class name as browser system variable value.

Nowadays DriverFactory is probably preferred to WebDriverProvider because the latter cannot use Selenide proxy and downloads folder. If you don't need them - it's fine to use WebDriverProvider too.

  • Method Summary

    Modifier and Type
    createDriver(org.openqa.selenium.Capabilities capabilities)
    Create new WebDriver instance.
  • Method Details

    • createDriver

      @CheckReturnValue @Nonnull org.openqa.selenium.WebDriver createDriver(@Nonnull org.openqa.selenium.Capabilities capabilities)
      Create new WebDriver instance. The instance will be bound to current thread, so there is no need to cache this instance in method implementation. Also don't cache the instance in static variable, as WebDriver instance is not thread-safe.
      capabilities - set of desired capabilities as suggested by Selenide framework; method implementation is recommended to pass this variable to WebDriver, probably modifying it according to specific needs
      new WebDriver instance