For me, the problem was that webbrowser.py did not recognize any other browser on my Windows machine. So, I had to register a browser and launch a new tab.
import webbrowser urL='https://www.google.com' firefox_path="C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe" webbrowser.register('firefox', None,webbrowser.BackgroundBrowser(firefox_path),1) webbrowser.get('firefox').open_new_tab(urL)
Hope this helps someone.
Also some python notes for help on what the register does,
webbrowser.register (name, constructor [, instance]) ΒΆ
Register your browser type name. Once a browser type is registered, the get () function can return a controller for that browser type. If an instance is not specified or is None, the constructor will be called without parameters to create an instance if necessary. If an instance is provided, the constructor will never be called and may be None. This entry point is only useful if you plan to either set the BROWSER variable or call get () with a non-empty argument corresponding to the name of the handler you are declaring.
Yogamurthy
source share