本文共 1063 字,大约阅读时间需要 3 分钟。
_IEGetObjByName AND _IEGetObjById:Returns an object variable by name or id.
即: 返回一个指定id或者name的对象变量
#include <IE.au3>
_IEGetObjByName ( ByRef $o_object, $s_Id [, $i_index = 0] )例子:
; *******************************************************
; Example 1 - Open a browser to the form example, get an object reference ; to the element with the id "su". In this case the ; result is identical to using $oSubmit = _IEGetObjById ($oIE, "su") ; ******************************************************* ; #include <IE.au3> $oIE = _IECreate ("www.baidu.com") Sleep(1000) $oSubmit = _IEGetObjById ($oIE, "su")例子:
; *******************************************************
; Example 1 - Open a browser to the basic example, get an object reference ; to the DIV element with the ID "line1". Display the innerText ; of this element to the console. ; ******************************************************* ; #include <IE.au3> $oIE = _IE_Example ("basic") $oDiv = _IEGetObjById ($oIE, "line1") ConsoleWrite(_IEPropertyGet($oDiv, "innertext") & @CRLF) PS: 这个方法应该比较实用, 尤其是用到页面元素的时候。转载地址:http://mgcci.baihongyu.com/