Modify the PAMIE for attach opened IE

来源:互联网 发布:股票手机模拟软件 编辑:程序博客网 时间:2024/06/06 13:46
class PAMIE:    """    cPAMIE is an automation object based on the work of PAMIE by RLM    http://pamie.sourceforge.net/    """    __version__ = "3.0"    def __init__(self, url=None, timeOut=3000, cur_ie=None):        """ The class instantiation code. When the object is instantiated you can        pass a starting URL. If no URL is passed then about:blank, a blank        page, is brought up.        parameters:            [url]     - url to navigate to initially            [timeOut] - how many 100mS increments to wait, 10 = 1sec, 100=10sec            [cur_ie]  - opened IE that want to attach        returns:            Nothing        """                #pythoncom.CoInitialize()                self.showDebugging = True           # Show debug print lines?        self.colorHighlight = "#F6F7AD"     # Set to None to turn off highlighting        self.frameName = None               # The current frame name or index. Nested frames are                                            # supported in the format frame1.frame2.frame3        self.formName = None                # The current form name or index        self.busyTuner = 1                  # Number of consecutive checks to verify document is no longer busy.                if None == cur_ie:            self._ie = win32com.client.dynamic.Dispatch('InternetExplorer.Application')            if url:                self._ie.Navigate(url)            else:                self._ie.Navigate('about:blank')        else:            self._ie = cur_ie        self._timeOut = timeOut        self._ie.Visible = 1        #self._ie.resizable = 1        #self._ie.fullscreen = 1        self._ie.MenuBar=1         self._ie.ToolBar=1         self._ie.AddressBar=1                self.timer = datetime.datetime.now()