Package co.verisoft.fw.selenium.drivers
Class VerisoftDriverManager
java.lang.Object
co.verisoft.fw.selenium.drivers.VerisoftDriverManager
A global, thread safe, singleton class. It handles augmentation of WebDriver objects of different types
- Since:
- 1.9.6
- Author:
- David Yehezkel
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
addDriverToMap
(org.openqa.selenium.WebDriver driver) Register driver with the current thread id to the mapstatic <T extends org.openqa.selenium.WebDriver>
TReturns driver with the current thread id, if you have more than 1 driver an error will be thrownstatic <T extends org.openqa.selenium.WebDriver>
TReturns driver by name for current thread id.Returns the map of drivers associated with the current thread id.static void
Removes drivers for the current thread from the driver map.
-
Method Details
-
addDriverToMap
public static void addDriverToMap(org.openqa.selenium.WebDriver driver) Register driver with the current thread id to the map- Parameters:
driver
- WebDriver object to be added to the map
-
getDrivers
Returns the map of drivers associated with the current thread id.- Returns:
- Map of driver names to WebDriver objects associated with the current thread id
-
getDriver
Returns driver by name for current thread id.- Parameters:
driverName
- Name of the driver to retrieve- Returns:
- T - template of WebDriver. i.e, if you know that the stored WebDriver object is VeriSoftDriver, just do VerisoftDriver driver = VerisoftDriverManager.getDriver();. No casting needed
-
getDriver
@Nullable public static <T extends org.openqa.selenium.WebDriver> T getDriver()Returns driver with the current thread id, if you have more than 1 driver an error will be thrown- Returns:
- T - template of WebDriver. i.e, if you know that the stored WebDriver object is VeriSoftDriver, just do VerisoftDriver driver = VerisoftDriverMananer.getDriver();. No casting needed
-
removeDriversForCurrentThread
public static void removeDriversForCurrentThread()Removes drivers for the current thread from the driver map.
-