I am not being able to open a new tab in chrome. My requirement is to open a new tab do some operation then close this new tab and come back to old tab.
The below python code worked in Firefox but not working in Chrome. Could anyone please help me?
ActionChains(driver).key_down(Keys.CONTROL,body).send_keys('t').key_up(Keys.CONTROL).perform()
解决方案
Guess this will be helpful:
from selenium import webdriver
driver = webdriver.Chrome()
driver.execute_script("window.open('','_blank');")
This piece of code should start new Chrome browser session and open blank page in new tab
Use driver.execute_script("window.open('URL');") to open new tab with required URL