Note that there are some explanatory texts on larger screens.

plurals
  1. POUsing .Net Web Control - How to Set a Value in a TextBox *INSIDE* of an IFRAME
    text
    copied!<p>I'm trying to use a .Net WebBrowser control to log into a website and aggregate some data for me. I'm also using a reference to MSHTML (but I don't care if your solution does or doesn't).</p> <p>When I visit a 'normal' website - I create an mshtml.HTMLDocument from the webBrowser's .documment. Then I create a mshtml.FormElement and a mshtml.HTMLInputElement using the name of the textbox I want. </p> <p>Then, I can set the value of the textBox.</p> <p>It looks something like this:</p> <pre><code> Dim myDoc1 As mshtml.HTMLIFrame = DirectCast(Me.WebBrowser.Document.DomDocument, mshtml.HTMLDocument) Dim myForm As mshtml.HTMLFormElement = DirectCast(myDoc1.forms.item(0), mshtml.HTMLFormElement) Dim myUserBox As mshtml.HTMLInputElement = DirectCast(myForm.item("user"), mshtml.HTMLFormElement) myUserBox.value = UserName </code></pre> <p>My problem is that on some websites the textbox I need to manipulate is contained inside of an IFRAME. An example would be <a href="https://servicing.capitalone.com/c1/login.aspx" rel="nofollow noreferrer">https://servicing.capitalone.com/c1/login.aspx</a></p> <p>If my program surfs to that site - it can't find a textbox for the Username - because there isn't one. There is only an IFRAME tag that has a URL of '<a href="https://login.capitalone.com/loginweb/login/login.do" rel="nofollow noreferrer">https://login.capitalone.com/loginweb/login/login.do</a>'</p> <p>If I surf directly to the login.do page - the website redirects me to an error page. </p> <p>How can I enter data into the UserName textbox in that IFRAME?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload