I am attempting to open a new tab OR a new window in a browser using selenium for python. It is of little importance if a new tab or new window is opened, it is only important that a second instance of the browser is opened.
I have tried several different methods already and none have succeeded.
for handle in driver.window_handles:
from selenium.webdriver.common.keys import Keys
driver.send_keys(Keys.CONTROL + 'T')
driver.find_element_by_id('elementID').send_keys(Keys.CONTROL + 'T')
driver.find_element_by_id('wrapper').send_keys(Keys.CONTROL + 'T')
act = ActionChains(driver)
How about you do something like this
driver = webdriver.Firefox() #First FF window second_driver = webdriver.Firefox() #The new window you wanted to open
Depending on which window you want to interact with, you send commands accordingly
print driver.title #to interact with the first driver print second_driver.title #to interact with the second driver
For all down voters:
The OP asked for "
it is only important that a second instance of the browser is opened.". This answer does not encompass ALL possible requirements of each and everyone's use cases.
The other answers below may suit your particular need.