Python webbrowser.open() 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 = "http://docs.python.org/library/webbrowser.html"
webbrowser.get(using='google-chrome').open(url,new=new)
you can use any other browser by changing the parameter 'using' as given in a link
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 = 'http://docs.python.org/'
# MacOS
chrome_path = 'open -a /Applications/Google\ Chrome.app %s'
# Windows
# chrome_path = 'C:/Program Files (x86)/Google/Chrome/Application/chrome.exe %s'
# Linux
# chrome_path = '/usr/bin/google-chrome %s'
webbrowser.get(chrome_path).open(url)
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("http://google.com")
See: Python: generic webbrowser.get().open() for chrome.exe does not work
Please check this:
import webbrowser
chrome_path = 'C:/Program Files (x86)/Google/Chrome/Application/chrome.exe %s'
webbrowser.get(chrome_path).open('http://docs.python.org/')