Get Recaptcha2 Iframe HTML but always EMPTY using GeckoFX Browser in vb.net -
i using latest geckofx-45 browser vb.net.
my problem: can not html of iframe.
here code:
'open recaptcha2 test site browser.navigate("http://patrickhlauke.github.io/recaptcha/") 'wait loading (all ways know) browser.navigatefinishednotifier.blockuntilnavigationfinished() dim maxtimeouttime 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 html of iframe empty: each _e geckoiframeelement in browser.domdocument.getelementsbytagname("iframe") if _e.getattribute("title") = "recaptcha widget" dim html = _e.contentdocument '-> empty dim html2 = _e.outerhtml '-> html not include content of iframe exit end if next the site displayed in browser , recaptcha2 iframe loaded completly , ready how can access programatically?
thank much
use contentwindow.document instead of contentdocument. code shoud be:
dim ifr_dom geckodomdocument dim ifr_html string each ifr geckoiframeelement in browser.domdocument.getelementsbytagname("iframe") if ifr.getattribute("title") = "recaptcha widget" ifr_dom = ifr.contentwindow.document 'domdocument has no outerhtml property use ifr_html = ifr_dom.getelementsbytagname("body")(0).outerhtml 'or if above not work, use code below 'ifr_html = ifr_doc.getelementsbytagname("body")(0).outerhtml exit end if next
Comments
Post a Comment