I am trying to load a page using vbscript. Then i enter some dummy values in its input fields and try to submit it.
Here is the code for it:
Dim ie
Set ie = WScript.CreateObject("InternetExplorer.Application")
ie.navigate("http://somepage.com")
ie.width = 900
ie.height = 600
ie.Visible = 1
WScript.sleep(5000)
'Home page of user is loaded.
'Now find the field containing mobile number and type message
Dim nameField, messageField
set nameField = ie.document.getElementById("MobileNos")'this line throws error
nameField.value = "somebody"
messageField = ie.document.getElementById("Message")
messageField.value = "Hi"
'Sending the message
ie.document.frmpostcomment.submit()
But whenever I try to run this code doesn’t post the comment, instead it just refreshes the page.
Thanks in advance.
During the post of the form I should have written
This worked for me.