35888894 发表于 2009-7-11 22:17:02

如何获得控件ID2

在使用163邮箱的时候,捕捉不到写邮件里面的图片控件,不管焦点在哪里它都提示
控件名称:index
控件类型:HTML 文档
如图:

35888894 发表于 2009-7-11 22:17:42

这个是工具箱的代码
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <ie.au3>
#Region ### START Koda GUI section ### Form=F:\AU3 for 2009\IE自动化\自动化函数测试\测试工具箱\Form1.kxf
$Form1 = GUICreate("测试工具箱", 539, 314, 238, 208)
$Input1 = GUICtrlCreateInput("http://tg1a148.mail.163.com/a/j/js3/main.jsp?sid=WDNaWbWWcjluBGNQNaWWGIrcwanHrnzW", 8, 8, 521, 21)
$Button1 = GUICtrlCreateButton("链接窗口", 8, 120, 75, 25, $WS_GROUP)
$Button2 = GUICtrlCreateButton("控件名称", 8, 152, 75, 25, $WS_GROUP)
$Button3 = GUICtrlCreateButton("捕获2号", 8, 184, 75, 25, $WS_GROUP)
$Button4 = GUICtrlCreateButton("Button4", 8, 216, 75, 25, $WS_GROUP)
$Button5 = GUICtrlCreateButton("Button5", 8, 248, 75, 25, $WS_GROUP)
$Button6 = GUICtrlCreateButton("Button6", 8, 280, 75, 25, $WS_GROUP)
$Button7 = GUICtrlCreateButton("Button1", 96, 120, 75, 25, $WS_GROUP)
$Button8 = GUICtrlCreateButton("Button2", 96, 152, 75, 25, $WS_GROUP)
$Button9 = GUICtrlCreateButton("Button3", 96, 184, 75, 25, $WS_GROUP)
$Button10 = GUICtrlCreateButton("Button4", 96, 216, 75, 25, $WS_GROUP)
$Button11 = GUICtrlCreateButton("Button5", 96, 248, 75, 25, $WS_GROUP)
$Button12 = GUICtrlCreateButton("Button6", 96, 280, 75, 25, $WS_GROUP)
$Button13 = GUICtrlCreateButton("Button1", 184, 120, 75, 25, $WS_GROUP)
$Button14 = GUICtrlCreateButton("Button2", 184, 152, 75, 25, $WS_GROUP)
$Button15 = GUICtrlCreateButton("Button3", 184, 184, 75, 25, $WS_GROUP)
$Button16 = GUICtrlCreateButton("Button4", 184, 216, 75, 25, $WS_GROUP)
$Button17 = GUICtrlCreateButton("Button5", 184, 248, 75, 25, $WS_GROUP)
$Button18 = GUICtrlCreateButton("Button6", 184, 280, 75, 25, $WS_GROUP)
$Button19 = GUICtrlCreateButton("Button1", 272, 120, 75, 25, $WS_GROUP)
$Button20 = GUICtrlCreateButton("Button2", 272, 152, 75, 25, $WS_GROUP)
$Button21 = GUICtrlCreateButton("Button3", 272, 184, 75, 25, $WS_GROUP)
$Button22 = GUICtrlCreateButton("Button4", 272, 216, 75, 25, $WS_GROUP)
$Button23 = GUICtrlCreateButton("Button5", 272, 248, 75, 25, $WS_GROUP)
$Button24 = GUICtrlCreateButton("Button6", 272, 280, 75, 25, $WS_GROUP)
$Input2 = GUICtrlCreateInput("", 8, 32, 521, 21)
$Input3 = GUICtrlCreateInput("", 8, 56, 521, 21)
$Input4 = GUICtrlCreateInput("", 8, 80, 521, 21)
$Edit1 = GUICtrlCreateEdit("", 352, 120, 177, 185,BitOR($ES_AUTOVSCROLL,$ES_READONLY,$ES_WANTRETURN, $WS_VSCROLL))
GUISetState(@SW_SHOW)
WinSetOnTop("测试工具箱","",1)
_IEErrorHandlerRegister()
#EndRegion ### END Koda GUI section ###

While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit
                Case $Button1
                                $oIE = _IECreate(GUICtrlRead($Input1),1,1)
                        $oDoc= _IEDocGetObj($oIE)
                Case $Button2
                                Local $bv,$bv2
                                                $bv=$oDoc.activeElement.form.name
                        GUICtrlSetData($Edit1,"表单:"&$bv&@CRLF&"控件名称:" & $oDoc.activeElement.name&@CRLF& "控件类型:" & $oDoc.activeElement.type& @CRLF& "控件ID:"&$oDoc.activeElement.id& @CRLF& "控件文本:" &$oDoc.activeElement.value&@CRLF&"引用的URL:" & $oDoc.document.referrer _
                                                        &@CRLF&"引用的文档URL:"&$oDoc.document.URL&@CRLF&"获取节点的引用:" & $oDoc.html)
                Case $Button3
                                        $bv=_IEAttach ( $oDoc.activeElement.URL,"Embedded")
                                ;        $oForms = _IEFormGetCollection($bv)
                                ;        For $Form In $oForms
                                ;                FileWriteLine($file, @CRLF & @CRLF & "表单名称: " & $Form.name & @CRLF)
                                        GUICtrlSetData($Edit1, IsObj ( _IEDocGetObj ($bv))&"   "& IsObj($oDoc.implementation)&""&IsObj($oIE))
                                ;        Next
                Case $Button4
                                        GUICtrlSetData($Edit1,$oDoc.activeElement.outerHTML)
                Case $Button5
                                                                $oInputs = _IETagNameGetCollection ($oIE, "IFRAME")
                                                                For $oInput In $oInputs
                                                        GUICtrlSetData($Edit1,"Form: " & $oInput.form.name & " Type: " & $oInput.type)                       
                                                                Next

                               
               
        EndSwitch
WEnd
页: [1]
查看完整版本: 如何获得控件ID2