selenium python new tab code example
Example 1: selenium python activate new tab
browser.execute_script("window.open('');")
browser.switch_to.window(browser.window_handles[1])
browser.get(tab_url)
Example 2: python selenium create new tab
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
driver = webdriver.Firefox()
driver.get("http://www.google.com/")
driver.find_element_by_tag_name('body').send_keys(Keys.COMMAND + 't')
driver.get('http://stackoverflow.com/')
driver.find_element_by_tag_name('body').send_keys(Keys.COMMAND + 'w')
driver.close()