How do we switch to another window using its handle?
driver.switchTo().window(handleOfTabWeWantToSwitch);
We need to create a loop to switch to windows that is opening later on.
To switch back to the main window (default window):
driver.switchTo().window(mainHandle);