I'm working on some code to automate posting auctions to eBay. I'm
using LWP, HTTP::Request, HTTP::Cookies, and the "click" method of
HTML::Form to click through the various pages of their new "Sell Your
Item 2.0" form. The code works great for most categories, but there
are some categories (Men's Clothing, Tickets & Travel, etc...) that
have a few extra options like Size, Color, State, # of tickets that
are presented in javascript-enabled drop downs. Unfortunately, when my
code gets to this stage, it appears to get a blank page in return when
I use the click method on the button in the form. I won't post the
whole script here because there are different options added depending
on where in the process it is, but this should be a reasonable
snippet:
use LWP;
use HTTP::Request::Common;
use HTTP::Cookies;
use HTML::Form;
.
.
.
my $ua = LWP::UserAgent->new;
$ua->cookie_jar(HTTP::Cookies->new(file=>'lwp-cookies',autosave=>1));
# trying to fake a compatible browser, but doesn't work either!
$ua->agent("Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0)");
.
.
.
my @form = HTML::Form->parse($html, $base_uri);
if ($hash{"Category1"}) {
$form[0]->value(category1 => $hash{"Category1"} ) ;
}
my $req = $ua->request($form[0]->click("buttoncontinue"));
my $html = $req->content;
Does anyone see anything fishy in this code that would cause it to die
when it sees some javascript or anything like that? If anyone would
like the complete script to look at, let me know...
Many Thanks in advance!
dirthurts |