How to run java for loop in parallel?
<p>I am newbie learning selenium and wrote below java code. I am trying to run a for loop that is supposed to load the site 20 times. Right now it does loop in sequential order and I want that to be run in parallel.</p>
<pre><code>public class lenders {
    
   //ExtentReports logger = ExtentReports.get(lenders.class);
   public static void main(String[] args) throws InterruptedException  {
                            
   for (int i=0; i&lt;20; i++) {
      FirefoxDriver driver= new FirefoxDriver();
      driver.manage().timeouts().pageLoadTimeout(1, TimeUnit.SECONDS);

      try {
         driver.get(&quot;https://www.google.com&quot;);
      } catch (TimeoutException e) {
           driver.quit();
      }
}
</code></pre>
<p>Towards the end I want 20 browsers to be open and loading the site and all of them getting killed.</p>