Board index » Visual Studio » VBScript form posting via IE - any way to vary fields?
|
SingHisPraz
|
VBScript form posting via IE - any way to vary fields?
Visual Studio260
Hello all... First off, let me say thanks to everyone here for the information I've found so far on this subject. It's been a huge help! I'm working on automating some site walk-throughs for one of our clients. As a part of the process, there are various forms that will need to be filled out on certain pages. I'm driving the process with an Access database (we have a few hundred checks we manually perform every day for our client) so that it's easily modified. One of the problems that I'm running into, however, is that when filling in forms via VBScript, I've got to hard-code the references to the field names in the actual code of my application. For example, here's the same Yahoo! login script floating around here -- Dim theForm Set IE = CreateObject("InternetExplorer.Application") IE.Navigate "mail.yahoo.com" IE.Visible = TRUE Do Until IE.Busy = FALSE WScript.Sleep 10 Loop Set theForm = IE.document.Forms(1) ie.document.login_form.login.value="TESTING" ie.document.login_form.passwd.value="TESTING" ie.document.login_form.submit() This would work fine .... if every single site we had to monitor used "login_form" for the acutal login, and "login" and "passwd" for the fields on that form. However, that isn't the case. Hopefully you can see my dilemma -- for every new page, I've got to modify my script any my database structure to handle a new type of login form. We're constantly adding and removing pages from our checks, so I'd really prefer not to do this -- it makes my code awfully messy. Does anyone know of a way that I can reference forms/fields in IE via their absolute value as they're found on the page? For example, form(1), field(1) and field(2)? I've tried a few variations with no luck, and the documentation I've read doesn't leave me too hopful. Thanks in advance! -Douglas Toombs - |
