I'm trying to write a script that will launch firefox for me, open up google in a new tab, and be able to do a search (for instance, www.espn.com). I'm currently trying to achieve this by using the webbrowser module, however I run into an error each time that I try launching Firefox from the script. Also, firefox is not my default browser.
import webbrowser
webbrowser.get('firefox').open_new_tab('http://www.google.com')
Whenever I run this I get the following error:
Traceback (most recent call last):
File "C:/Python33/test Bing.py", line 6, in <module>
webbrowser.get('firefox').open_new_tab('http://www.google.com')
File "C:\Python33\lib\webbrowser.py", line 53, in get
raise Error("could not locate runnable browser")
webbrowser.Error: could not locate runnable browser
I'm unsure why the script is struggling to locate the firefox.exe I have also tried specifying in 'firefox'
the actual location of firefox.exe in c: however I still get the same error.
I'm sure that there's a small error in my code that I currently can't see, if someone could help point out what I'm doing wrong I'd greatly appreciate it!