
com.codeborne.selenide.WebDriverProvider Maven / Gradle / Ivy
package com.codeborne.selenide;
import org.openqa.selenium.Capabilities;
import org.openqa.selenium.WebDriver;
import javax.annotation.CheckReturnValue;
import javax.annotation.Nonnull;
import javax.annotation.ParametersAreNonnullByDefault;
/**
*
* Interface for using custom WebDriver in your tests
*
*
*
* To customize {@link WebDriver} creation one can use any of the alternatives:
*
* - Call method {@link com.codeborne.selenide.WebDriverRunner#setWebDriver(WebDriver)} explicitly.
*
- Extend {@link WebDriver} implementation, override {@code public XxxDriver(Capabilities desiredCapabilities)}
* constructor and pass this class name as {@code browser} system variable value.
*
- Implement this very interface and pass the implementation class name as {@code browser} system variable value.
*
*/
@ParametersAreNonnullByDefault
public interface WebDriverProvider {
/**
* Create new {@link 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.
*
* @param desiredCapabilities set of desired capabilities as suggested by Selenide framework; method implementation is
* recommended to pass this variable to {@link WebDriver}, probably modifying it according to specific needs
* @return new {@link WebDriver} instance
*/
@CheckReturnValue
@Nonnull
WebDriver createDriver(@Nonnull Capabilities desiredCapabilities);
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy