2012-06-11 31 views
0

我尝试使用了AutoIt从本网站获取的一些数据链接:无法检索内部框架

http://www.acgme.org/adspublic/default.asp

不幸的是,该网页使用了框架,我有麻烦导航到页面,数据是。

的联系是“认可程序”

#include <IE.au3> 

$URL="http://www.acgme.org/adspublic/" 
$MyIExplorer=_IECreate($URL,1,1,1,1) 

Local $theFrame = _IEGetObjById($MyIExplorer,"control") 
MsgBox(0,"The Frame",$theFrame.src) 

Local $oLinks = _IELinkGetCollection($theFrame) 
MsgBox(0, "Link Count", @extended & " links found") 

当我运行上面的代码,我能够填充$theFrame用,里面的“认可程序”链接正确的帧的对象,但是这远我可以得到。 $oLinks集合回来为空。

回答

4

框架比较特殊。改为使用_IEFrameGetObjByName。

#include <IE.au3> 

$URL="http://www.acgme.org/adspublic/" 
$MyIExplorer=_IECreate($URL,1,1,1,1) 

Local $theFrame = _IEFrameGetObjByName($MyIExplorer,"control") 

Local $oLinks = _IELinkGetCollection($theFrame) 
MsgBox(0, "Link Count", @extended & " links found") 
+0

谢谢@Manadar,我试过'_IEFrameGetObjByName'在一个点上,无法让它工作。我认可这是一个AutoIt新手。我最终通过使用'_IEFrameGetCollection'来代替我的代码。谢谢你的帮助! – Airn5475