Can't retrieve links inside Frame

↘锁芯ラ 提交于 2019-12-12 07:03:58

问题


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.

The link is "Accredited Programs"

#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")

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.


回答1:


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")


来源:https://stackoverflow.com/questions/10982682/cant-retrieve-links-inside-frame

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!