Hello Monks,

I am wondering what could be the issue with mechanize find_link in this case, The URL am trying is the below one

 my $url = "http://careers.republic.co.uk/pb3/corporate/Republic/search.php";

After clicking the First page button, it will lead us to a page which carries some jobs. There is a Next Page also. I am trying to automate to the next page using find_link of mechanizewith url regex(/page=2/) or text regex(/Next/). but it is giving me some other links

Pls can any monks help me out of this..... My code is below,

use strict; use WWW::Mechanize; my $search_url = "http://careers.republic.co.uk/pb3/corporate/Republic +/search.php"; my $mech = WWW::Mechanize->new(); eval{ $mech->agent_alias('Mac Safari'); $mech->get($search_url); $mech->click('p_bRun'); }; my $next = $mech->find_link( text_regex => qr#Next# ); # my $next = $mech->find_link( url_regex => qr#page=2# ); # Either wa +y not succeding print $next->url() . "\n"; #exit; my $filename = 'path.html'; $mech->save_content( $filename ); exit;

Pls help me out of this monks, Thanx to all.


In reply to Wondering what could be the issue with mechanize find_link. by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.