0

I'm automating Selenium tests using TestNG's data-provider-thread-count which runs tests in parallel. But I could see that username, password of one test i.e. driver is being passed to another one.

I analyzed my code and there I could see that for each thread I've Webdriver instance and there is no objects which are shared across, hence I think there is no chance of sharing test data of test with another.

Could you please let me know what could be other possible reasons so accordingly I'll analyze my code and try to find root cause?

Alpha
  • 13,320
  • 27
  • 96
  • 163
  • Please share your code. – AndiCover Dec 11 '19 at 08:53
  • Add ThreadGuard when you are instantiating the driver . WebDriver driver = ThreadGuard.protect(new FirefoxDriver()); https://selenium.dev/selenium/docs/api/java/org/openqa/selenium/support/ThreadGuard.html If there is exception then your webdriver is not threadsafe – Rahul L Dec 17 '19 at 10:01
  • @RahulL, thanks for the details! I'll give a try with this. – Alpha Dec 18 '19 at 05:04
  • @RahulL, with ThreadGuard browser is not loading all the contents and hence unable to find some elements(run this several times and each time saw same behaviour). And if we remove ThreadGuard all the elements are loaded and tests continue. – Alpha Dec 18 '19 at 13:03
  • @TDHM - Please edit your post and add the problematic code in question so that we can find out what is going wrong (Please clean up the code and post a [mcve](https://stackoverflow.com/help/minimal-reproducible-example) version of your code. – Krishnan Mahadevan Dec 18 '19 at 18:25
  • @TDHM ThreadGuard does not have any overhead or effect on loading of elements. Please share mcve version of you code – Rahul L Dec 19 '19 at 03:36

0 Answers0