Created
April 28, 2026 17:01
-
-
Save borodicht/63b2727ecab83bcaa8ffbc59539680c1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package tests; | |
| import org.openqa.selenium.WebDriver; | |
| public class DriverManager { | |
| private static final ThreadLocal<WebDriver> driverThreadLocal = new ThreadLocal<>(); | |
| public static WebDriver getDriver() { | |
| return driverThreadLocal.get(); | |
| } | |
| public static void setDriver(WebDriver driver) { | |
| driverThreadLocal.set(driver); | |
| } | |
| public static void quitDriver() { | |
| WebDriver driver = driverThreadLocal.get(); | |
| if (driver != null) { | |
| driver.quit(); | |
| driverThreadLocal.remove(); | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment