All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.codeborne.selenide.WebDriverProvider Maven / Gradle / Ivy

There is a newer version: 7.6.1
Show newest version
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. *

* *

* See https://github.com/selenide/selenide/wiki/How-Selenide-creates-WebDriver for overview *

* *

* To customize {@link WebDriver} creation one can use any of the alternatives: *

    *
  • Call method {@link com.codeborne.selenide.WebDriverRunner#setWebDriver(WebDriver)} explicitly. *
  • Extend {@link com.codeborne.selenide.webdriver.DriverFactory} implementation *
  • Extend {@link WebDriver} implementation, override {@code public XxxDriver(Capabilities capabilities)} * 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. *
* *

* Nowadays {@link com.codeborne.selenide.webdriver.DriverFactory} is probably preferred to {@link WebDriverProvider} because * the latter cannot use Selenide proxy and downloads folder. If you don't need them - it's fine to use {@link WebDriverProvider} too. *

*/ @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 capabilities 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 capabilities); }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy