How to set up samie 1.1...
1) Go to http://www.activeperl.com and download and Install Active Perl 5.8.0 build 806 Windows MSI 2) Download samie.zip, extract to any directory and click on setup.exe 3) Try the test.pl and test1.pl scripts found in the product directory. (for example: c:\Program Files\Premium Quality Inc\samie) The main file used by samie is found here by default c:\Perl\site\lib\Win32\SAM.pm. Take a look in this file to see how samie was written. And to see what each subroutine takes as a parameter, some of them are optional. EXAMPLE FOUND HERE
Here is some boiler plate stuff to help you get started...
use strict;
use Win32::OLE;
use Win32::SAM;
#use Win32::Slingshot;
$| = 1;
my $URL = "http://www.amazon.com/exec/obidos/subst/home/home.html/103-9172868-6219849";
my $seconds;
$Win32::OLE::Warn = 3;
StartIE();
$seconds = Navigate($URL);
print "First Page took $seconds seconds to load\n";
SetListBoxItem("url","index=baby");
SetEditBox("field-keywords","Diaper");
$seconds = ClickFormImage("Go");
print "Second Page took $seconds seconds to load\n";
-------------------------------------------------------------------------------
A little explanation:
sub SetListBoxItem { #$SelectName, $ItemName Notice SetListBoxItem uses "url" and "Baby", look at Amazon's view source html
<select name=url> <option value="index=aps" selected>All Products <option value="index=books">Books <option value="index=music">Popular Music <option value="index=music-dd">Music Downloads <option value="index=classical">Classical Music <option value="index=dvd">DVD <option value="index=vhs">VHS <option value="index=restaurants">Restaurants (Beta) <option value="index=theatrical">Movie Showtimes <option value="index=toys">Toys <option value="index=baby">Baby
sub SetEditBox { #$name, $value Notice SetEditBox uses "field-keywords" and "diaper" look at Amazon's view source html <input type="text" name="field-keywords" size="15">
Finally sub ClickFormImage { #$imageName, TRUE Notice ClickFormImage uses "Go"
This could be confusing we actually are using the alt= or the
value=
look at Amazon's view source html <input type=image name="Go" value="Go!" border=0 alt="Go!" src=http://g-images.amazon.com/images/G/01/v9/search-browse/go-button-gateway.gif width=21 height=21 border=0 align=absmiddle >
|
|