import webbrowser
Chrome = 'C:\Program Files (x86)\Google\Chrome\Application\chrome.exe'
webbrowser.get(Chrome).open("haveibeenpwned.com")
Whenever I try I get this "could not locate runnable browser"
P.S: I'm tryna learn python
import webbrowser
Chrome = 'C:\Program Files (x86)\Google\Chrome\Application\chrome.exe'
webbrowser.get(Chrome).open("haveibeenpwned.com")
Whenever I try I get this "could not locate runnable browser"
P.S: I'm tryna learn python
You should register it first.
webbrowser.register('chrome', None,webbrowser.BackgroundBrowser(Chrome), 1)
webbrowser.get('chrome').open_new_tab("haveibeenpwned.com")
You should use UNIX-style path: common slashes instead of backslashes.
import webbrowser
chrome = 'C:/Program Files (x86)/Google/Chrome/Application/chrome.exe'
webbrowser.get(chrome).open("haveibeenpwned.com")
Seems like the problem is the spaces in your path. You need to insert a final %s
at the end of your path to make it work. No need to register the browser name first.
webbrowser.get(
"C:/Program Files (x86)/Google/Chrome/Application/chrome.exe %s"
).open("haveibeenpwned.com")
As seen here: Python: generic webbrowser.get().open() for chrome.exe does not work