not sure if this will help you or not but kleinama in VBForums has a pretty good Webpage manipulation thread going:
Manipulate/Change/Form Fill data in webpages using the Webbrowser control - VBForums
|
|
I'm using vb.net and the web browser control on a win form application where I have a dynamically created 'parent' html page that contains an 'iframe' that points to another dynamically created html page. Get it? Now, the exact reason why I'm doing this isn't the issue, but I'm trying to access the actual html code that resides within the child (iframe) page programatically through vb.net and the web browser control properties/methods (or whatever else...).
Here's what's going on with the code below:
The parent page gets 'navigated' to within the browser control that's sitting on my win form. The iframe gets loaded as well, and immediately begins the submission of the form data (currently 12 times, with an interval of 250ms). As each submission occurs, the parent gets updated through javascript with the current iteration number. When complete, the response to the form posting will present info within the iframe element. I need the actual HTML of the iframe element at this time but I'm not sure how to reference the child objects (elements?) within the web browser control. Can you help? Please include some examples if you're able. Thanks for the help!
Here's the Parent page:
Here's the Child code:Code:<HTML> <BODY> <form id="formsubmit"> <input type="text" id="postCounter" value="0";> <iframe name="iFrame1" src="childpage.html" width="50%" align="left"> </form> </iframe> </BODY> </HTML>
Code:<HTML> <head> <SCRIPT type="text/javascript"> var t=0; var i=0; function load() { t = setInterval("submitme()",250); } function submitme() { var ctl; ctl=parent.document.forms[0].postCounter; i = parseInt(ctl.value); i=i+1; ctl.value = i; if (parseInt(i)<12) { document.forms[0].submit(); } else { clearInterval(t); } } </SCRIPT> </head> <body onLoad="load();"> <form> FORM TO POST GOES HERE</form> </BODY> </HTML>
---------------------------------------------
So you say I jump from perfectly good airplanes? Maybe you should take a gander and the junk we jump from...
Probably safer outta the plane than in.
not sure if this will help you or not but kleinama in VBForums has a pretty good Webpage manipulation thread going:
Manipulate/Change/Form Fill data in webpages using the Webbrowser control - VBForums
To access the Html elements that the browser parses into the DOM tree you always use the Document property, this is your door in. In this case you must take a step back in the tree from the loaded document back to the Window object to access its Frames, then you select the correct frame by integer/string index and get into its Document tree. Here is a sample path that uses what I just described and display the body source of a frame:
Code:MsgBox(Me.WebBrowser1.Document.Window.Frames(0).Document.Body.InnerHtml)
Some useful links: Learning videoes, Code Samples, WMI Code Creator, MSDN, The Code Project, WindowsClient.net, ASP.net, W3 Schools, Regular-Expressions.info, GDI+ FAQ
How to format posts with code blocks etc - present the problem/post properly
There are currently 2 users browsing this thread. (0 members and 2 guests)
Bookmarks