Class VerisoftDriverManager

java.lang.Object
co.verisoft.fw.selenium.drivers.VerisoftDriverManager

public final class VerisoftDriverManager extends Object
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 Type
    Method
    Description
    static void
    addDriverToMap(org.openqa.selenium.WebDriver driver)
    Register driver with the current thread id to the map
    static <T extends org.openqa.selenium.WebDriver>
    T
    Returns driver with the current thread id, if you have more than 1 driver an error will be thrown
    static <T extends org.openqa.selenium.WebDriver>
    T
    getDriver(String driverName)
    Returns driver by name for current thread id.
    static @Nullable Map<String,org.openqa.selenium.WebDriver>
    Returns the map of drivers associated with the current thread id.
    static void
    Removes drivers for the current thread from the driver map.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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

      @Nullable public static @Nullable Map<String,org.openqa.selenium.WebDriver> 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

      @Nullable public static <T extends org.openqa.selenium.WebDriver> T getDriver(String driverName)
      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.