[SP-pm] Clicar em Avançar Mechanize
Andre Carneiro
andregarciacarneiro at gmail.com
Fri Nov 28 08:56:33 PST 2008
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]_)
Cheers!
2008/11/28 Daniel de Oliveira Mantovani <daniel.oliveira.mantovani at 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 at pm.org
> http://mail.pm.org/mailman/listinfo/saopaulo-pm
>
--
André Garcia Carneiro
Analista/Desenvolvedor Perl
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/saopaulo-pm/attachments/20081128/b1ec5e50/attachment-0001.html>
More information about the SaoPaulo-pm
mailing list