Re: Fwd: click_button gives error on a existing button



Hi again,
yes, I have this line:
my $browser2 = WWW::Mechanize->new(autocheck => 1);
where I initilize browser2 variable

The strange thing is that in the following while, when I print browser2
content everything seems to be allright , Next 25 records button exists in
the html but .. it fails when passing from page 2 to page 3

while($test eq 0){
#$content=$browser2->submit_form("DBSELECT");
print "justo antes de fallar";
$browser2->click_button( value => "Next 25 records");
print "justo despues de 25 next";
$content = $browser2->content();

@html = split ("\n",$content);
foreach my $linea (@html){

if($linea =~ /.*Results of searching.*/){
$test=1;

}
print $linea;
}
if(!$test){
print "error in getting main query page, will try again in 30
seconds\n";
sleep 30;
}
}

You can see the whole script in
http://tlloreti.googlepages.com/pct3.pl

Thanks!
T.

On 12/28/06, Owen <rcook@xxxxxxxxxxx> wrote:

On Thu, 28 Dec 2006 09:53:05 +0100
"Tatiana Lloret Iglesias" <tlloreti@xxxxxxxxx> wrote:

> Thanks Owen,
> but in this case, inspecting the html page i see that the button hasn't
got
> NAME attribute but only VALUE that's why i've used value command.
> The strange thing is that to pass from page 1 to page 2 it works but to
> pass from page 2 to page 3 it fails ... although the code is the same
and
> the button exists!

> On 12/28/06, Owen Cook <rcook@xxxxxxxxxxx> wrote:
> >
> > On Thu, Dec 28, 2006 at 08:46:25AM +0100, Tatiana Lloret Iglesias
wrote:
> > > Hi!
> > > I'm executing this perl and I get an error in this line_
> > > $browser2->click_button( value => "Next 25 records");
> > >
> > > but i dont understand why because Next 25 records button exists!!
> > > Can you help me with this please?
> > > You can download the script from:
> > > http://tlloreti.googlepages.com/pct3.pl

> >
> > Normally buttons have names.
> >
> > $browser2->click_button( value => "Next 25 records",
> > name => "Whatever");
> >
> > Then you have a "Whatever" button, and when clicked, sends "Next 25
> > records" back to the server



You need to track down the origin of
$browser2->click_button( value =>"Next 25 records");

At the start of your program there should be some use statements, like
'use strict;'

What other use statements are there?

Then you will need to look a little further down the program and maybe
find something like

$browser2 = new->browser(some args perhaps);

So have you got anything like that?




Owen


Quantcast