How to automate the submission of html form, with random text values using vbscript?
A:
You can use the "Microsoft.XMLHTTP" to automate the form submittal. Please see below:
Set xml = Server.CreateObject("Microsoft.XMLHTTP")
' Notice the two changes in the next two lines:
xml.Open "POST", "http://www.imdb.com/Find", False
xml.Send "select=All&for=The Usual Suspects"
wscript.echo xml.responseText
Or take a look at these great posts:
http://www.4guysfromrolla.com/webtech/110100-1.2.shtml
mrTomahawk
2009-05-15 13:14:26
This would be correct in the case of ASP. But this does not work automation of form submission from a normal (*.vbs) file.
Smart Pandian
2009-05-22 11:00:43
I don't know what you mean. The example I showed has nothing to do with server side code being ASP, it could CGI, PHP, hell even Ruby all that matters is that you submit the values expected by the server side code during a form submit. You also asked how it could be done using VBScript, which is what my example(s) are showing. Can you revise your to maybe emphasize what problem your trying to overcome?
mrTomahawk
2009-05-27 13:49:21
I guess Smart Pandian means that `Server` is ASP-specific object, which is not available in Windows Script Host (he says he uses *.vbs files, that is, runs code as a Windows script, not web script). In this case, the first statement should be changed to `Set xml = CreateObject("Microsoft.XMLHTTP")`.
Helen
2010-02-01 10:39:26
A:
You may want to use Selenium (http://seleniumhq.org/) or Waitr (http://wtr.rubyforge.org/) as they will allow you better control and are built to do what you are looking for.
Josh
2009-05-15 13:18:30
A:
<html>
<form action='http://127.0.0.1/file.php' method='POST' id=1>
<input type=hidden name="var" value="val">
<input type=submit>
</form>
</html>
<script>
document.getElementById(1).submit();
</script>
Rook
2010-02-01 06:05:34