I am using the latest GeckoFX-45 Browser for vb.net.
My problem: I can not get the HTML of the Iframe.
Here is my code:
'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
The site is displayed very well in the Browser and the recaptcha2 iframe is loaded completly and ready but how can I access it programatically?
Thank you very much
Use
ContentWindow.Document
instead ofContentDocument
. Your code shoud be: