The first thing you need to know in order to be able to answer your question yourself (via man pages, this site or Google) is to find out which program Python's webbrowser
module is starting, and this can be done without any need to guesswork based on what its looks like.
You can find the default that Python selects for you with the following:
>>> import webbrowser
>>> print webbrowser.get().name
(at the Python prompt you can leave out the print
statement, but not in a program)
Based on that you should be able to find documentation on the program that is launched, how to select input fields, and how to quit.
If the webbrowser.get().name
comes back with xdg-open
, then that commandline utility will launch the systems preferred browser application. You can find out what that is with:
update-alternatives --display www-browser
this might not be applicable to your case, since in my experience xdg-open
would try and open a file 'www.google.com'
if you hand that string to webbrowser.open()
.
In general you should explicitly use a URL with that function, e.g.:
>>> webbrowser.open('http://google.com')
If you want to change the default that Python selects to any browser mentioned in the other answers or anything else that you have found and fancy, there are various things you can do. You will of course first have to make sure that the actual program that you want to get started, is installed. After that:
there is a programmatic way to achieve your goal in Python by calling webbrowser.get()
with a parameter selecting the selection string of browser of your choice.
you can set the BROWSER environment variable as specified in the documentation
if xdg-open
is the program called from Python, you can use the above mentioned update-alternatives
to set the default browser:
update-alternatives --config www-browser