Selenium Grid, how to utilize WebDriver with ThreadSafeSeleniumSessionStorage.session() Selenium Grid, how to utilize WebDriver with ThreadSafeSeleniumSessionStorage.session() selenium selenium

Selenium Grid, how to utilize WebDriver with ThreadSafeSeleniumSessionStorage.session()


I have not tried this code but if it works then you would have an object that holds Selenium based WebDriver. As per my understanding this feature is there for migration from Selenium 1 to Selenium 2. This is not the recommended way to make web driver thread safe.

WebDriver by default is not thread safe. I would recommend to instantiate one WebDriver instance for each thread.


You can look into the implementation of ThreadSafeSeleniumSessionStorage class and use the same logic to create a new ThreadSafeWebdriverSessionStorage. Can't you? Source is here

It uses the ThreadLocal class. Shouldn't be difficult to implement.