Answer the question
In order to leave comments, you need to log in
Is it possible to open a new tab/window in Selenium?
Hello, I am working on the parser of one site, and at the behest of its creators, my parser needs to transfer information from one page to another with minimal loss of time, which is why the get () option is not suitable because it moves on a new one in the same tab link. My goal until the parser has started working is to open two tabs / windows at once, and switch between them when working.
Answer the question
In order to leave comments, you need to log in
The easiest option is to create a new browser instance.
Another option is to run
driver.execute_script("window.open('https://google.com')")
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
driver = webdriver.Firefox()
driver.get("http://stackoverflow.com/")
body = driver.find_element_by_tag_name("body")
body.send_keys(Keys.CONTROL + 't')
driver.close()
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question