WSH - Clicking submit button (VBS)

NEODARK

Gawd
Joined
Aug 10, 2004
Messages
1,002
Hey guys,

Need some help, I've been having a hard time targeting, then clicking a form button to submit a form with my script. The button is in a frame, and it also has onclick code attached to it like so:

Code:
<input value="Refresh" name="go" onclick="document.skipCheck=true; setTimeout('document.forms[\'StampForm\'].submit();',1);" type="button">

The script must do the following:

1- Open IE
2- enter login and password data
3- submit the form.
4- Once that's completed wait for IE to load the new page
5- finally click another form button on the page that loads, which is within a frame.
6- stop

1- 4 is not a problem, but the 2nd button is not working. No matter what I try, here's the code I have:

Code:
Option Explicit

Dim objIE : Set objIE = CreateObject("InternetExplorer.Application")

objIE.Navigate "about:blank"
objIE.Visible = True

 WScript.Sleep 500

objIE.Navigate "www.site.com"

Do Until objIE.ReadyState = 4
  WScript.Sleep 500
Loop 

objIE.Document.All.logonForm.username.value = "login name"
objIE.Document.All.logonForm.password.value = "123456"
objIE.Document.All.logonForm.submit.click()

With objIE
  While .Busy
    'Do Nothing
  Wend
  While .document.Readystate <> "complete"
    'AgaIn Do Nothing
  Wend
End With
[b]'My code works until it gets to the line below[/b]
[b]'It errors with object does not support this etc[/b]
objIE.Document.All.Forms("StampForm").Item("go").Click()

I cannot change the code of the form itself, and I'm still new to WSH and VBS.

I tried these as well with no result: :(

1. objIE.document.all.Item("go").Click
2. objIE.document.forms(StampForm).Submit
3. objIE.document.forms(StampForm).Submit.click
4. objIE.homebody.Document.StampForm.Submit 'homebody is the name of the frame

All of this results in the following error: (line 29 is the last line on the script)

Line 29
Char 1
Objet doesn't support this property or method: etc, etc...
800A01B6

Please help :)
 
Back
Top