[SP-pm] Clicar em Avançar Mechanize
Alexei Znamensky
russoz at gmail.com
Fri Nov 28 09:38:52 PST 2008
Daniel,
De um script que estou fazendo:
print "choosing to find by part number... ";
$agent->follow_link( text => 'Find by Part Number' );
Procure esse método "follow_link".
[]s,
Russo
2008/11/28 Daniel de Oliveira Mantovani <daniel.oliveira.mantovani em gmail.com
>
>
> Eu sei mas o click sao para buttons.
>
> 2008/11/28 Andre Carneiro <andregarciacarneiro em gmail.com>
>
> Existe um método 'click' em WWW::Mechanize...
>>
>>
>>
>> http://search.cpan.org/~petdance/WWW-Mechanize-1.52/lib/WWW/Mechanize.pm#$mech-%3Eclick(_$button_[,_$x,_$y]_)<http://search.cpan.org/%7Epetdance/WWW-Mechanize-1.52/lib/WWW/Mechanize.pm#$mech-%3Eclick%28_$button_%5B,_$x,_$y%5D_%29>
>>
>>
>>
>> Cheers!
>>
>> 2008/11/28 Daniel de Oliveira Mantovani <
>> daniel.oliveira.mantovani em gmail.com>
>>
>>> Tenho o seguinte problema, vou dar um exemplo:
>>> Nesse site :
>>> http://www.magicdomain.com.br/index.php?sub=colecoes&idSerie=57
>>>
>>> Se olhar em baixo irão se deparar com o "Avançar", eu quero que sempre
>>> que encontre um avançar ele "click" e entre, e caso esse que ele entrou
>>> encontre "Avançar" de novo ele entre e assim por diante.
>>> Na verdade ele só precisa retornar os links. Estou tentando algo do tipo.
>>>
>>> 1 #!usr/bin/perl
>>> 2
>>> 3 use strict;
>>> 4 use warnings;
>>> 5
>>> 6 use WWW::Mechanize;
>>> 7
>>> 8 my $mech = WWW::Mechanize->new(timeout => 30);
>>> 9 $mech->get('
>>> http://www.magicdomain.com.br/index.php?sub=colecoes&begin=1'<http://www.magicdomain.com.br/index.php?sub=colecoes&begin=1%27>
>>> );
>>> 10 if ( $mech->success ) {
>>> 11 foreach my $busters ( $mech->find_all_links( url_regex =>
>>> qr/idSerie|/ ) ) {
>>> 12 $mech->get( $busters->url_abs() );
>>> 13 while ( $mech->content=~ qr/Avançar/ ) {
>>> 14 $mech->follow_link( qr/Avançar/ );
>>> 15 print $mech->url_abs,"\n";
>>> 16 }
>>> 17 }
>>> 18 }
>>> 19 else {
>>> 20 print "Não pode pegar o site\n";
>>> 21 }
>>>
>>>
>>> --
>>> Procuro emprego C.V:
>>> http://www.danielmantovani.site50.net/
>>>
>>> print
>>> "\x54\x68\x65\x20\x53\x69\x6c\x65\x6e\x74\x20\x47\x75\x61\x72\x64\x69\x61\x6e",$/
>>>
>>>
>>> _______________________________________________
>>> SaoPaulo-pm mailing list
>>> SaoPaulo-pm em pm.org
>>> http://mail.pm.org/mailman/listinfo/saopaulo-pm
>>>
>>
>>
>>
>> --
>> André Garcia Carneiro
>> Analista/Desenvolvedor Perl
>>
>>
>> _______________________________________________
>> SaoPaulo-pm mailing list
>> SaoPaulo-pm em pm.org
>> http://mail.pm.org/mailman/listinfo/saopaulo-pm
>>
>
>
>
> --
> Procuro emprego C.V:
> http://www.danielmantovani.site50.net/
>
> print
> "\x54\x68\x65\x20\x53\x69\x6c\x65\x6e\x74\x20\x47\x75\x61\x72\x64\x69\x61\x6e",$/
>
>
> _______________________________________________
> SaoPaulo-pm mailing list
> SaoPaulo-pm em pm.org
> http://mail.pm.org/mailman/listinfo/saopaulo-pm
>
--
Alexei Znamensky [russoz_gmail_com] [russoz.wordpress.com] [
www.flickr.com/photos/alexeiz]
"Though we live in trying times, we're the ones who have to try"
-------------- Pr�xima Parte ----------
Um anexo em HTML foi limpo...
URL: <http://mail.pm.org/pipermail/saopaulo-pm/attachments/20081128/48b4b018/attachment.html>
More information about the SaoPaulo-pm
mailing list