How to open multiple webpages in separate tabs within a browser using selenium-webdriver and python
To open multiple URLs / webpages in seperate TABs within a browser you can use the following solution :
-
Code Block :
from selenium import webdriver first_page = "http://www.google.com" second_page = "https://www.facebook.com/" options = webdriver.ChromeOptions() options.add_argument("start-maximized") options.add_argument('disable-infobars') driver=webdriver.Chrome(chrome_options=options, executable_path=r'C:\Utility\BrowserDrivers\chromedriver.exe') driver.get(first_page) driver.execute_script("window.open('" + second_page +"');")
Browser Snapshot :