Skip to main content

Posts

Showing posts from October, 2023

Create DriverManager class to create a instance for Various Drivers like chromderiver, firefoxdriver

 Hi All, Today we are continuing with what is  DriverManager Class and what is the responsibility of this class. DriverManager is abstract class . Here  ThreadLocal<RemoteWebDriver> driver is a static ThreadLocal variable that stores the RemoteWebDriver instance.  A ThreadLocal allows each thread to have its own copy of the variable, ensuring thread safety in parallel execution. The createDriver() method is declared as abstract, indicating that it must be implemented by subclasses. This method is responsible for creating the RemoteWebDriver instance. getDriver() is a static method that returns the RemoteWebDriver instance stored in the ThreadLocal variable. setWebDriver(RemoteWebDriver driver_) is a static method used to set the RemoteWebDriver instance in the ThreadLocal variable. This code serves as a base class for managing the creation and retrieval of the RemoteWebDriver instance. By using ThreadLocal , it ensures that each thread has its own ...