1

This is what I have so far. Do I need to change anything to make webbrowser package use Google Chrome?

import webbrowser
web = input('What website would you like to open? i.e. pbskids.org')
webbrowser.open(web)
smci
  • 32,567
  • 20
  • 113
  • 146
Marcus Lee
  • 13
  • 3
  • 2
    Read [the documentation](https://docs.python.org/3/library/webbrowser.html) for details about how to specify which browser to open. – Code-Apprentice Jan 31 '21 at 02:53
  • @Ruvee: the proper package tag is [tag:python-webbrowser]. Also, this question has at least a [hundred existing duplicates going as far back as 2014](https://stackoverflow.com/search?q=%5Bpython%5D+webbrowser+chrome), and should be closed as duplicate. – smci Jan 31 '21 at 04:47

3 Answers3

0

Follow these steps in your Python Application to open URL in Chrome Browser. Register the browser type name using webbrowser. register() . Also provide the browser executable file path. Get the controller object for the browser using webbrowser. get() and Open URL using open(). More details Here

Here is an example;

import webbrowser

url = 'https://pythonexamples.org'
webbrowser.register('chrome',
    None,
    webbrowser.BackgroundBrowser("C://Program Files (x86)//Google//Chrome//Application//chrome.exe"))
webbrowser.get('chrome').open(url)
Irfan wani
  • 4,084
  • 2
  • 19
  • 34
-2

Try setting the default browser as IE and then change it back to Chrome again?

Check the preferences of your programming app (Eg. PyCharm, Jupyter etc.)

-2

Usually, this is just an issue with your default browser. If you navigate to your Windows settings page, you can change the default browser to another installed web browser, in your case, Google Chrome.

smci
  • 32,567
  • 20
  • 113
  • 146
Jacob Lee
  • 4,405
  • 2
  • 16
  • 37