无法检索框架内的链接 [英] Can't retrieve links inside Frame
本文介绍了无法检索框架内的链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试使用AutoIt从该网站检索一些数据:
I am trying to use AutoIt to retrieve some data from this website:
http://www.acgme.org/adspublic/default.asp
不幸的是,该页面使用框架,我无法导航到数据所在的页面.
Unfortunately, the page uses frames and I'm having trouble navigating to the page where the data is.
链接为认可程序"
#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")
当我运行上面的代码时,我可以使用容纳"Accredited Programs"链接的正确框架对象填充 $ theFrame
,但这是我所能做到的. $ oLinks
集合变空.
When I run the code above, I am able to populate $theFrame
with the correct frame object that houses the "Accredited Programs" link, but that's as far as I can get. The $oLinks
collection comes back empty.
推荐答案
框架非常特殊.改用_IEFrameGetObjByName.
Frames are rather special. Use _IEFrameGetObjByName instead.
#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")
这篇关于无法检索框架内的链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文