def close(self): """Close the browser.""" # win32gui.PostMessage(self.msie_window, win32con.WM_CLOSE, 0, 0) username = getpass.getuser() process_names = ( 'iexplore.exe', 'chrome.exe', 'firefox.exe', 'safari.exe', 'opera.exe', 'dwwin.exe', 'dw15.exe', 'iedw.exe', 'telnet.exe', 'msimn.exe', 'seamonkey.exe', 'k-meleon.exe', 'flock.exe', 'navigator.exe', 'maxthon.exe', 'avant.exe', 'dillo.exe', 'luna.exe', ) for name in process_names: # Kill all processes matching name, using # pv.exe from teamcti.com (freeware): # http://www.teamcti.com/pview/prcview.htm os.system('pv.exe -kf -y%s %s "2>nul" > nul' % (username, name)) short = short_filename(name) if short != name: os.system('pv.exe -kf -y%s %s "2>nul" > nul' % (username, short))
def close(self): """ Close the browser. """ try: if "command" in self.__dict__: name = os.path.basename(self.command.split(" ")[0]) os.system('pv.exe -kf %s "2>nul" > nul' % name) short = short_filename(name) if short != name: os.system('pv.exe -kf %s "2>nul" > nul' % short) except: doNothing = ""