Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/401.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript Autoit:在网站的iframe中访问并模拟单击链接_Javascript_Dom_Iframe_Autoit - Fatal编程技术网

Javascript Autoit:在网站的iframe中访问并模拟单击链接

Javascript Autoit:在网站的iframe中访问并模拟单击链接,javascript,dom,iframe,autoit,Javascript,Dom,Iframe,Autoit,我正在autoit中做一个项目,我想阅读本网站iframe中元素的数据(示例),但我需要首先单击iframe右下方的链接(“登陆…”),这不是一个真正的链接,下载我需要的数据,这是iframe中加入锦标赛的球队列表 我知道交叉重点击,但这两个网站是在同一个域,所以我想我可以访问,但我只能访问框架,但不能访问其中的元素 我想知道是否有人有建议,因为我在这个问题上坚持了将近一个月。我目前正在考虑将javascript插入到主页的HTML中,以获取该信息并将其作为主页的一个元素传递出去 #includ

我正在autoit中做一个项目,我想阅读本网站iframe中元素的数据(示例),但我需要首先单击iframe右下方的链接(“登陆…”),这不是一个真正的链接,下载我需要的数据,这是iframe中加入锦标赛的球队列表

我知道交叉重点击,但这两个网站是在同一个域,所以我想我可以访问,但我只能访问框架,但不能访问其中的元素

我想知道是否有人有建议,因为我在这个问题上坚持了将近一个月。我目前正在考虑将javascript插入到主页的HTML中,以获取该信息并将其作为主页的一个元素传递出去

#include <MsgBoxConstants.au3>
#include <IE.au3>

$oIE=_IECreate('http://worldoftanks.com/clanwars/maps/globalmap/?province=CA_91')
Local $oFrames = _IEFrameGetCollection($oIE)
Local $iNumFrames = @extended
Local $sTxt = $iNumFrames & " frames found" & @CRLF & @CRLF
Local $oFrame = 0
    $oFrame = _IEFrameGetCollection($oIE, 0)
    $sTxt &= _IEPropertyGet($oFrame , "innerhtml") & @CRLF ; it crash right here or return code 80020009 if using error handle
MsgBox($MB_SYSTEMMODAL, "Frames Info", $sTxt)
#包括
#包括
$oIE=_IECreate('http://worldoftanks.com/clanwars/maps/globalmap/?province=CA_91')
本地$oFrames=\u IEFrameGetCollection($oIE)
本地$iNumFrames=@extended
本地$sTxt=$iNumFrames&“找到的帧”&@CRLF&@CRLF
本地$oFrame=0
$oFrame=\u IEFrameGetCollection($oIE,0)
$sTxt&=\u IEPropertyGet($oFrame,“innerhtml”)&@CRLF;如果使用错误句柄,它将在此处崩溃或返回代码80020009
MsgBox($MB_SYSTEMMODAL,“帧信息”$sTxt)

$oFrame
的使用方法与普通IE窗口完全相同,您是否在其上尝试过任何IE*功能?因为他们都工作

例如,以下是与帮助文件中的
\u IELinkGetCollection()
示例合并的
\u IELinkGetCollection()
示例

#include <IE.au3>
#include <MsgBoxConstants.au3>

Local $oIE = _IE_Example("frameset")
Local $oFrames = _IEFrameGetCollection($oIE)
Local $iNumFrames = @extended
Local $sTxt = $iNumFrames & " frames found" & @CRLF & @CRLF
Local $oFrame = 0
For $i = 0 To ($iNumFrames - 1)
    $oFrame = _IEFrameGetCollection($oIE, $i)
    $sTxt &= _IEPropertyGet($oFrame, "innertext") & @CRLF
Next
;~ MsgBox($MB_SYSTEMMODAL, "Frames Info", $sTxt)

; Get the frame object we are interested in.
$oFrame = _IEFrameGetCollection($oIE, 1)

; Add a link as an example.
_IEBodyWriteHTML($oFrame, '<a href="#test">This is a link</a>')

; Get all links in that frame:
Local $oLinks = _IELinkGetCollection($oFrame, -1)
Local $iNumLinks = @extended

Local $sTxt = $iNumLinks & " links found" & @CRLF & @CRLF
For $oLink In $oLinks
    $sTxt &= $oLink.href & @CRLF
Next
MsgBox($MB_SYSTEMMODAL, "Link Info", $sTxt)

_IEQuit($oIE)
#包括
#包括
本地$oIE=\u IE\u示例(“框架集”)
本地$oFrames=\u IEFrameGetCollection($oIE)
本地$iNumFrames=@extended
本地$sTxt=$iNumFrames&“找到的帧”&@CRLF&@CRLF
本地$oFrame=0
对于$i=0到($iNumFrames-1)
$oFrame=\u IEFrameGetCollection($oIE,$i)
$sTxt&=\u IEPropertyGet($of名称,“innertext”)&@CRLF
下一个
;~ MsgBox($MB_SYSTEMMODAL,“帧信息”$sTxt)
; 获取我们感兴趣的帧对象。
$oFrame=\u IEFrameGetCollection($oIE,1)
; 添加一个链接作为示例。
_IEBodyWriteHTML($of名称,“”)
; 获取该帧中的所有链接:
本地$oLinks=\u IELinkGetCollection($oFrame,-1)
本地$iNumLinks=@extended
本地$sTxt=$iNumLinks&“找到的链接”&@CRLF&@CRLF
$oLink中的$oLink
$sTxt&=$oLink.href&@CRLF
下一个
MsgBox($MB_SYSTEMMODAL,“链接信息”$sTxt)
_IEQuit($oIE)

Matt,你对我的问题有什么建议吗?我会在期末考试结束后再尝试。我使用了$oFrame=\u IEFrameGetCollection($oIE,0)\u IELinkGetCollection($oFrame,-1),但我仍然在get link集合中得到了“访问被拒绝”代码80020009