Peace all, I am currently trying to use VBScript to fill out a web form (and submit it).
For example, I am using this script.
Code:
Set IE = CreateObject("InternetExplorer.Application")
set WshShell = WScript.CreateObject("WScript.Shell")
IE.Navigate "http://mylogin.page"
IE.Visible = True
Wscript.Sleep 6000
IE.Document.All.Item("fld_userName").Value = "adley"
IE.Document.All.Item("fld_password").Value = "password"
WshShell.AppActivate "IE"
WshShell.SendKeys "{ENTER}"
My problem is this.
The script above works for most pages, but there are a few exceptions that I hoped someone in this forum would help me.
1. If the connection is sooo slow, the "Sleep" line above is not that effective. Does anyone know a better way, such as a "wait until page completely loaded" function?
2. I am using SendKeys above, but for cases where the web page doesn't necessarilly accept ENTER after filling out the password, I need something else. I encounter this for a web page requiring me to select a value from a drop-down box and click the "Log On" button afterward. I can specify the value to be selected, but sending ENTER (or TAB then ENTER) was useless. I don't know how to set a focus to a web object/field using VBScript.
Any help would be much appreciated. Thanks.