1def OpenNewTab(driver, Link):
2 window_count = len(driver.window_handles)
3 driver.execute_script('''window.open("'''+Link+'''","_blank");''')
4 while len(driver.window_handles) != window_count+1:
5 time.sleep(0.5)
6 driver.switch_to.window(driver.window_handles[-1])