Can anyone explain use of Driver Factory and its implementation to get parallel browser at same time?



  • When do we need to create a Driver Factory ? What advantages do we get over regular initialisation of driver when we use driver factory approach.

    Also how to initiate parallel browser testing using Driver factory.



  • The main idea of running Selenium test in parallel is ensuring that there are no clashes and race conditions between WebDriver instances. The common practice is implementing Thread Local Storage pattern in order to isolate WebDrivers and other data which is not thread-safe

    WebDriver by design is not thread safe so if you intend to have several threads to run different webdriver instances you need to wrap them into ThreadLocal and most probably the "DriverFactory" you're talking about is a helper class which initializes webdriver puts it to ThreadLocal.

    Check out Parallel Tests - Best Practices for comprehensive information, tips, tricks and sample projects.



Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2