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:
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.
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:
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
Please help
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.
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 "[URL unfurl="true"]www.site.com"[/URL]
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]'The 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()
Stop
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
Please help