use Win32::OLE;
use Win32::SAM;
#use Win32::Slingshot;
$| = 1;
my $URL = "http://www.google.com/";
my $seconds;
$Win32::OLE::Warn = 3;
StartIE();
$seconds = Navigate($URL);
print "Google Page took $seconds seconds to load\n";
SetEditBox("q","Presidents");
$seconds = ClickFormButton("btnG");
print "Query Page took $seconds seconds to load\n";
Going through the code line by line...
$seconds = ClickFormButton("btnG");
This code makes a call to the ClickFormButton subroutine which in located in c:\per\site\lib\win32\SAM.pm
In HTML the Form Button is defined with the <input type="submit"...> tag
nested inside a <form> tag.
Use the View Source
command to see the html for any page.
The ClickFormButton subroutine clicks on the Form Button, which sends
information to the webserver and requests a new page.
The
first parameter for ClickFormButton uses the name element of the form button.
Here is an example of a name element to a form button:
<input TYPE="submit" NAME="Request" VALUE="Submit This Form">
The ClickFormButton subroutine returns the number of seconds it takes to load the page that was requested from the remote webserver.