Thread Guard Class in Selenium

When we run our test cases in in parallel using TestNg in selenium, you might have faced issues like some environmental, or some unknown isses halting the parallel execution.

Parallel execution is nothig but running the selenium in multiple threads, when one thred intrups the other thread then JVM throws exceptions

To avoid these kind of issues selenium provides a class called ThreadGuard, this class heps you solve the parallel running isssues.

Like webdriver listener we have to wrap the webdriver instance using the ThreadGuard class, for that purpose we a methods called protect() in ThreadGuard class.

										WebDriver driver = ThreadGuard.protect(new FirefoxDriver());			

This class has no imporatnce than protecting the webdrier on the multi-threads.

Join My Facebook Group
Join Group

About Author

Myself KarthiQ, I am the author of this blog, I know ways to write a good article but some how I donot have the skills to make it to reach people, would you like help me to reach more people By sharing this Article in the social media.

Share this Article Facebook
Comment / Suggestion Section
Point our Mistakes and Post Your Suggestions
Selenium-Webdriver.Com [Group]
Facebook Group · 801 members
Join Group
Learn Selenium Webdriver Concepts and Interview Questions Learn and code
Copyright © CherCher Tech