p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   VB How-To (http://p2p.wrox.com/forumdisplay.php?f=78)
-   -   Fill out a web form (http://p2p.wrox.com/showthread.php?t=9811)

mendy February 26th, 2004 12:21 PM

Fill out a web form
 
How would I use VB to find the names of fields on a web form and then fill out the form? For example going to the Juno page finding the password field and filling it out with a password stored in the VB program. Any reply would be really nice:)


Yehuda February 26th, 2004 12:26 PM

Where is the web form? Is your VB program running on the webserver or are you running on your machine?

mendy February 26th, 2004 12:33 PM

The VB program would run from my machine, nothing to do with the webserver.
Something that the Program "Gator" would do.

Yehuda February 26th, 2004 12:59 PM

Are you creating the web form is it a form you have no control over?

mendy February 26th, 2004 01:49 PM

it's a web form that I have no control over. For example, Juno's Login Page.


Yehuda February 26th, 2004 02:13 PM

Sorry, short of doing an elaborate set of mouse clicks and keyboard inserts, I don't know of any way of doing this.

mendy February 26th, 2004 03:35 PM

I can fill out the information using "sendkeys". All I really need is a way of getting the cursor in the proper field.


Yehuda February 26th, 2004 05:29 PM

You could send enough tabs to get it into the field or use a mouse click Win API. The only way I can think of to find the right field would be to dowload the HTML and parse the page. I don't think I need to say that there is a relatively large margin of error in this type of coding. I would definitely look into trying to contact the vendor and see if there is an integration point to work with.

pgtips February 27th, 2004 07:02 AM

I would use VB's WebBrowser control for this (you need to add "Microsoft Internet Controls" to your project for this). Drop one on a form, use the Navigate method to open the page you want, then WebBrowserName.document will give the DOM for that page and you can use standard DHTML syntax, like this:
With WebBrowserName.document
    .formname.fieldname.value = "whatever you want"
    .formname.submit()
End With

Note: make sure the page has loaded completely before trying to update the fields - there's an event for this, DownloadComplete or NavigateComplete - I forget which one...

hth
Phil

mendy February 27th, 2004 01:49 PM

That is great. It totally works. Thanks so much.



All times are GMT -4. The time now is 04:34 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.