Context: Currently I'm working with a Selenium based system in Java that runs tests using JUnit and Maven. Through the Maven Surefire plugin, I'm able to run tests in parallel. I have ensured the following things -
- ThreadLocal is used for singleton objects
- Separate WebDriver per thread
- Using explicit waits (e.g.
(new WebDriverWait(webdriver, timeout)).until(ExpectedConditions.________(_____));)
Problem: However, when running tests in parallel, I'm getting TimeoutExceptions at WebDriverWait explicit waits. This can occur at any places in the test that use explicit waits. These timeout exceptions do not occur when the tests are running sequentially.
Question: I would like to know whether any of you have encountered this situation and how you go about solving this problem. Other relevant information and feedback are welcomed too.
Thanks in advance! If you need any supplemented resources such as sample code, I'm happy to provide.