Python to open Chrome browser

Python to open Chrome browser

You can call get() with the path to Chrome. Below is an example – replace chrome_path with the correct path for your platform.

import webbrowser

url =

# MacOS
chrome_path = open -a /Applications/Google %s

# Windows
# chrome_path = C:/Program Files (x86)/Google/Chrome/Application/chrome.exe %s

# Linux
# chrome_path = /usr/bin/google-chrome %s


In the case of Windows, the path uses a UNIX-style path, so make the backslash into forward slashes.

webbrowser.get(C:/Program Files (x86)/Google/Chrome/Application/chrome.exe %s).open(

See: Python: generic webbrowser.get().open() for chrome.exe does not work

Python to open Chrome browser

import webbrowser 
new = 2 # open in a new tab, if possible

# open a public URL, in this case, the webbrowser docs
url =

you can use any other browser by changing the parameter using as given in a link

Leave a Reply

Your email address will not be published. Required fields are marked *