0 votes
1 view
in Python by (26.6k points)

I'm trying to launch a website URL in a new tab using python in that way, but it didn't work in these both ways:

Method 1:

os.system('C:\Program Files\Mozilla Firefox\Firefox.exe -new-tab http://www.google.com/');

and Method 2:

os.startfile('C:\Program Files\Mozilla Firefox\Firefox.exe -new-tab http://www.google.com/');

If I don't add the parameters (-new-tab http://www.google.com/) it works, opening the default page.

1 Answer

0 votes
by (16.8k points)

You need to use the webbrowser module:

import webbrowser


If you want to open a url in a non-default browser try:


Related questions

Welcome to Intellipaat Community. Get your technical queries answered by top developers !