1
總是空的使用GeckoFX瀏覽器,我使用的是最新GeckoFX-45瀏覽器vb.net。獲取Recaptcha2的iFrame HTML,但在vb.net
我的問題: 我不能得到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被加載並完全地準備好,但我怎麼能編程訪問它?
非常感謝您