com.codeborne.selenide.junit5.BrowserStrategyExtension Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of selenide Show documentation
Show all versions of selenide Show documentation
Selenide = concise API for Selenium WebDriver
package com.codeborne.selenide.junit5;
import org.junit.jupiter.api.extension.AfterAllCallback;
import org.junit.jupiter.api.extension.ExtensionContext;
import javax.annotation.ParametersAreNonnullByDefault;
import static com.codeborne.selenide.WebDriverRunner.closeWebDriver;
/**
* By using this extension browser will be automatically closed after all tests in the current container.
*
* To use this extension, extend your test class with it:
*
* {@code @ExtendWith({BrowserStrategyExtension.class}}
*
* Or register extension in test class:
*
* {@code @RegisterExtension static BrowserStrategyExtension browserStrategy = new BrowserStrategyExtension();}
*
*
* @author Aliaksandr Rasolka
* @since 4.12.2
*/
@ParametersAreNonnullByDefault
public class BrowserStrategyExtension implements AfterAllCallback {
@Override
public void afterAll(final ExtensionContext context) {
closeWebDriver();
}
}