【发布时间】:2016-07-10 11:17:42
【问题描述】:
我正在为 vb.net 使用最新的 GeckoFX-45 浏览器。
我的问题: 我无法获取 iframe 的 HTML。
这是我的代码:
'Open Recaptcha2 test site
Browser.Navigate("http://patrickhlauke.github.io/recaptcha/")
'Wait for loading (all ways I know)
Browser.NavigateFinishedNotifier.BlockUntilNavigationFinished()
Dim maxTimeouttime As DateTime = DateTime.Now.AddSeconds(4)
While DateTime.Now < maxTimeouttime
System.Windows.Forms.Application.DoEvents()
System.Threading.Thread.Sleep(100)
End While
While Browser.IsBusy()
System.Windows.Forms.Application.DoEvents()
System.Threading.Thread.Sleep(100)
End While
'Getting the HTML of the Iframe is always empty:
For Each _E As GeckoIFrameElement In Browser.DomDocument.GetElementsByTagName("iframe")
If _E.GetAttribute("title") = "recaptcha widget" Then
Dim html = _E.ContentDocument '-> is empty
Dim html2 = _E.OuterHtml '-> HTML does not include the content of the Iframe
Exit For
End If
Next
该网站在浏览器中显示得非常好,recaptcha2 iframe 已完全加载并准备就绪,但我如何以编程方式访问它?
非常感谢
【问题讨论】:
标签: vb.net iframe captcha recaptcha geckofx