JONCHAN-CN
4/19/2020 - 10:07 AM

switchSeleniumTab

from selenium import webdriver

# init new tab
driver.execute_script(f'window.open("{_rea_link}")')
# switch to new tab
driver.switch_to.window(driver.window_handles[-1])
# do whatever
driver.refresh()
# close new tab
driver.close()
# switch to main tab
driver.switch_to.window(driver.window_handles[0]