Andy Crouch Andy Crouch - 1 year ago 104
Python Question

Python :: How to open a page in the Non Default browser

I was trying to create a simple script to open a locally hosted web site for testing the css in 2 or more browsers. The default browser is IE7 and it opens the page fine but when I try to open a non default browser such as Firefox or Arora it just fails.

I am using the webbrowser module and have tried this several way as detailed in various sites across the web.

Is it possible and if so how?

Answer Source

Matt's right and it's a pretty useful module to know...

18.1. subprocess

IDLE 2.6.2      
>>> import subprocess
>>> chrome = 'C:\Users\Ted\AppData\Local\Google\Chrome\Application\chrome.exe'
>>> chrome_args = ''
>>> spChrome = subprocess.Popen(chrome+' '+chrome_args)
>>> print
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download