Package com.codeborne.selenide
Interface WebDriverProvider
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Interface for using custom WebDriver in your tests.
See https://github.com/selenide/selenide/wiki/How-Selenide-creates-WebDriver for overview
To customize WebDriver creation one can use any of the alternatives:
- Call method
WebDriverRunner.setWebDriver(WebDriver)explicitly. - Extend
DriverFactoryimplementation - Extend
WebDriverimplementation, overridepublic XxxDriver(Capabilities capabilities)constructor and pass this class name asbrowsersystem variable value. - Implement this very interface and pass the implementation class name as
browsersystem 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 TypeMethodDescriptionorg.openqa.selenium.WebDrivercreateDriver(org.openqa.selenium.Capabilities capabilities) Create newWebDriverinstance.
-
Method Details
-
createDriver
org.openqa.selenium.WebDriver createDriver(org.openqa.selenium.Capabilities capabilities) Create newWebDriverinstance. 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.- Parameters:
capabilities- set of desired capabilities as suggested by Selenide framework; method implementation is recommended to pass this variable toWebDriver, probably modifying it according to specific needs- Returns:
- new
WebDriverinstance
-