-1

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.

2 Answers 2

2

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.

0

DriverFactory (different implementations can be found here and here, or here for Katalon Studio version) acts like a switch statement when you are working with multiple browsers.

It is just like the regular initialization, just more flexible, since you can tell your test where the driver is located / which driver is being used.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.