InternetExplorer.Application .contentDocument:<permission refused =“”>

时间:2017-08-26 14:03:34

标签: vba iframe internet-explorer-11

我在法国...... 我在Excel下用VBA开发,我使用对象“InternetExplorer.Application”来浏览网站并保存内容。 在主页面上没有问题,但是当我加载通常在弹出窗口中打开的页面时,我无法检索iframe的内容:

<div id="fichecheval" data-zepro="hippodrome=DEAUVILLE&amp;dr=20170826&amp;nr=1&amp;nc=3&amp;nch=1">
<iframe src="//pro.zeturf.com/externe/zefiche_cheval_.php?hippodrome=DEAUVILLE&amp;dr=20170826&amp;nr=1&amp;nc=3&amp;nch=1&amp;ts=1503747108&amp;key=aecd0f4c33ce9588e38d7f8c6986ec778beeb88fffb940f07cfda0ec4a7768ab" frameborder="0" scrolling="yes" style="min-height: 5000px;">
</iframe>
</div>

我的代码:

Dim IFrame As HTMLDocument
Dim Content As Object
Dim html As HTMLDocument
Dim FormulaireConnexion As Object
Dim login As Object
Dim Password As Object
Dim jour As Object
Dim mois As Object
Dim annee As Object
Dim MyTag As Object
'Références et zones de chargement
Dim MyAdr As String
'Gestion fichiers
Dim intFic As Integer
Dim MyFile As String

'******************************************
'Instantiation InternetExplorer.Application
'******************************************
Set IE = CreateObject("InternetExplorer.Application")
'IE.Silent = True
IE.Visible = True
'*******************************
'Connexion avec authentification
'*******************************
IE.navigate "https://www.zeturf.fr"
Do
DoEvents
Loop While IE.readyState <> 4 And IE.Busy = True
Sleep 1000
Set login = IE.document.getElementById("connection_login")
login.Value = "toto"
Set Password = IE.document.getElementById("connection_password")
Password.Value = "toto66"
Set jour = IE.document.getElementById("connection_jour")
jour.Value = "01"
Set mois = IE.document.getElementById("connection_mois")
mois.Value = "01"
Set annee = IE.document.getElementById("connection_annee")
annee.Value = "1966"
Set FormulaireConnexion = IE.document.getElementById("connection_submit")
FormulaireConnexion.Click
Do
DoEvents
Loop Until IE.readyState = READYSTATE_COMPLETE And IE.Busy = False
Sleep 1000
'*****************
IE.navigate "https://www.zeturf.fr/fr/course/2017-08-26/R1C3-deauville-prix-de-la-reconversion-des-chevaux-de-courses-grand-handicap-de-la-manche/turf"
Do
DoEvents
Loop Until IE.readyState = READYSTATE_COMPLETE And IE.Busy = False
Sleep 1000
'*****************
MyAdr = "https://www.zeturf.fr/fr/course/2017-08-26/R1C3-deauville-prix-de-la-reconversion-des-chevaux-de-courses-grand-handicap-de-la-manche/turf/partants/2412257"
'_blank Load the link into a new unnamed window.
'_parent Load the link into the immediate parent of the document the link is in.
'_self Load the link into the same window the link was clicked in.
'_top Load the link into the full body of the current window.
IE.navigate MyAdr, , "_self"
Do
DoEvents
Loop Until IE.readyState = READYSTATE_COMPLETE And IE.Busy = False
Sleep 1000
'*****************
MyFile = ThisWorkbook.Path & "\Courses\test.html"
intFic = FreeFile
Open MyFile For Output As intFic
Print #intFic, IE.document.body.innerHTML
'*****************
Set IFrame = IE.document.frames().document.getElementsByTagName("iframe")(0)
Set Content = IFrame.getElementsByTagName("html")
Set IFrame = Nothing
'*****************
Close intFic

在“设置内容”上我有错误“权限被拒绝”,当我在间谍窗口中查看IFrame对象时,我有: IFrame:contentDocument: 我告诉自己我的导航不会模拟现实(没有弹出窗口),而是在同一个标​​签或第二个标签中打开... 你对这个问题有什么看法吗?谢谢你的帮助

0 个答案:

没有答案