you need specify your webbrowser's name, detal see webbrowser.get
import webbrowser webbrowser.open('www.google.com') a = webbrowser.get('firefox') a.open('www.google.com') # True
UPDATE
If you have chrome or firefox installed in your computer, do as following:
chrome_path =r'C:\Users\Administrator\AppData\Local\Google\Chrome\Application\chrome.exe' # change to your chrome.exe path # webbrowser is just call subprocess.Popen, so make sure this work in your cmd firstly # C:\Users\Administrator>C:\Users\Administrator\AppData\Local\Google\Chrome\Application\chrome.exe www.google.com # there two way solve your problem # you have change \ to / in windows # this seems a bug in browser = shlex.split(browser) in windows # ['C:UsersAdministratorAppDataLocalGoogleChromeApplicationchrome.exe', '%s'] a = webbrowser.get(r'C:/Users/Administrator/AppData/Local/Google/Chrome/Application/chrome.exe %s') a.open('www.google.com') #True # or by register webbrowser.register('chrome', None,webbrowser.BackgroundBrowser(r'C:\Users\Administrator\AppData\Local\Google\Chrome\Application\chrome.exe')) a = webbrowser.get('chrome') a.open('www.google.com') #True
else you can try selenium, it provide much more functions and only need chromedriver.