I am trying to multiple urls in multiple tabs within a browser window.
I am using webbrowser module in python:
My code:
import webbrowser
li = ['http://unix.com','http://google.com','http://yahoo.com']
for url in li:
webbrowser.open_new_tab(url)
This code works fine, if the browser is already opened.
If the browser is not started yet, then the code opens three new windows of the browser which i don;t want. How to control it to open within a browser window?
Opening a new tab pretty much suggests that a browser instance is already running. Perhaps opening an initial browser instance and then the tabs would work better.
import webbrowser
webbrowser.open_new('http://somesite.com')
li = ['http://unix.com','http://google.com','http://yahoo.com']
for url in li:
webbrowser.open_new_tab(url)
Thanks for your response.
i have tried the solution which you suggested. But that results in 4 browser windows and doesn't address the problem i mentioned.
SOo, all here needed is, opening a browser instance and wait until that instance opens completely.Then we need to invoke the other urls and so that they can open in the same window.