• <ruby id="5koa6"></ruby>
    <ruby id="5koa6"><option id="5koa6"><thead id="5koa6"></thead></option></ruby>

    <progress id="5koa6"></progress>

  • <strong id="5koa6"></strong>
  • Python操作IHTMLDocument2用于自動化測試

    發表于:2010-06-30來源:作者:點擊數: 標簽:pythonPython自動化
    Python操作IHTMLDocument2用于 自動化測試 軟件測試 有些軟件的界面采用Win32窗口嵌套一個IE控件,用Spy++只能識別出一個Internet Explorer_Server控件。常用的幾個API函數無法取到IE控件里面的內容,更無法對里面的控件進行操作,所以這給自動化帶來了麻煩

      Python操作IHTMLDocument2用于自動化測試 軟件測試

      有些軟件的界面采用Win32窗口嵌套一個IE控件,用Spy++只能識別出一個Internet Explorer_Server控件。常用的幾個API函數無法取到IE控件里面的內容,更無法對里面的控件進行操作,所以這給自動化帶來了麻煩。本文將講述如何使用Python獲取 IHTMLDocument2接口,用于自動化測試。

      獲取 IHTMLDocument2接口

      參考:http://support.microsoft.com/kb/249232

      相應的Python實現代碼如下:

      #!/usr/bin/env python

      #coding:utf-8

      __author__ = 'CoderZh'

      import sys

      # Important for multithreading

      sys.coinit_flags = 0 # pythoncom.COINIT_MULTITHREADED

      import win32com

      import win32com.client

      import win32gui

      import win32con

      import pythoncom

      def getIEServer(hwnd, ieServer):

      if win32gui.GetClassName(hwnd) == 'Internet Explorer_Server':

      ieServer.append(hwnd)

      if __name__ == '__main__':

      #pythoncom.CoInitializeEx(0) # not use this for multithreading

      mainHwnd = win32gui.FindWindow('windowclass', 'windowtitle')

      if mainHwnd:

      ieServers = []

      win32gui.EnumChildWindows(mainHwnd, getIEServer, ieServers)

    原文轉自:http://www.kjueaiud.com

    老湿亚洲永久精品ww47香蕉图片_日韩欧美中文字幕北美法律_国产AV永久无码天堂影院_久久婷婷综合色丁香五月

  • <ruby id="5koa6"></ruby>
    <ruby id="5koa6"><option id="5koa6"><thead id="5koa6"></thead></option></ruby>

    <progress id="5koa6"></progress>

  • <strong id="5koa6"></strong>