0

So if I run this code:

import webbrowser
browser = 'C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe %s'
webbrowser.get(browser).open_new('google.com')

Nothing happens i tried this with different browsers like Chrome,Opera,Firefox

When I run this code:

import webbrowser
browser = 'C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe %s'
webbrowser.open_new('google.com')

It opens link in Internet Explorer even though my default browser is Microsoft Edge and i need to open it in Microsoft Edge

1 Answers1

0

I tested it and I think the main issue is that you should use "http://google.com" instead of "google.com"

import webbrowser

default = webbrowser.get('windows-default')
default.open_new('http://google.com')

Edit: for clarity, the reason this is necessary is that it looks like the webbrowser package is for opening web-based documents, which could also be hosted locally and start with file:// as pointed out in the answer in the comment of your question.

William
  • 381
  • 1
  • 8