Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Python (http://www.velocityreviews.com/forums/f43-python.html)
-   -   Re: how can i register the non-default browser with the webbrowsermodule? (http://www.velocityreviews.com/forums/t951855-re-how-can-i-register-the-non-default-browser-with-the-webbrowsermodule.html)

Peter Otten 09-05-2012 04:09 PM

Re: how can i register the non-default browser with the webbrowsermodule?
 
Levi Nie wrote:

> how can i register the non-default browser with the webbrowser module?
>
> the case:
> i want open a site such as "google.com" in ie8 with the python.But my
> default is chrome.
> so i want to register a ie8 controller with the
> webbrowser.register(*name*, *constructor*[, *instance*]).
> so what does the parameter "constructor" "instance" mean?
> how can i do it?


Isn't there already a controller for ie8? I can't check, but you can list
the available browsers with

>>> import webbrowser
>>> list(webbrowser._browsers)

['x-www-browser', 'kfmclient', 'firefox', 'konqueror']

Then if you want to open a page with a specific browser just do

url = "http://www.python.org"
browser = "firefox"
webbrowser.get(browser).open(url)




All times are GMT. The time now is 01:39 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.