Here is a matrix of the test results depending on which browser is open upon starting the test script: No browser open: FF opens tab (ok) IE open: new tab in FF (ok), nothing in IE (ok) FF open: new tab in FF (ok), new tab in in IE (NOT ok) Both open: new tab in FF (ok), new tab in in IE (NOT ok)
Looking further in webbrowser.py, FF uses GenericBrowser: class GenericBrowser(BaseBrowser): """Class for all browsers started with a command and without remote functionality.""" ... def open(self, url, new=0, autoraise=True): cmdline = [self.name] + [arg.replace("%s", url) for arg in self.args] try: if sys.platform[:3] == 'win': p = subprocess.Popen(cmdline) else: p = subprocess.Popen(cmdline, close_fds=True) return not p.wait() If FF is already open, Popen.wait() returns TRUE for FF but FALSE for IE. This leads to fallthrough for FF and then calling open for IE.