I'm attempting my first complicated scraping project and have hit a wall. To get at the data I want to scrape, I need to submit several forms first. I'm using www:mech and got through the first form easy:
$browser->get( $starting_url ); $browser->form_name("GS"); $browser->submit();
This takes me to a new page with another form -- but this one has a Javascript "onClick" routine, and when I try various permutations of the following, it doesn't accept my input: This is the form code:
<form name="gs" METHOD="post" action="" onSubmit="cntyzip()" > <table width=70% align="center"> <tr> <td align=center colspan=2> You must either choose a <b>County < +font color="#FF0000"> &nbsp;or&nbsp;</font></b> enter a <b>Zip Code +</b></td></tr> <tr><td>&nbsp;</td></tr> <tr> <td colspan="2"> <table width = 76% align="center"> <tr> <td width="16%" align=left><font size=2>County:</font></td +> <td width="30%" align=left><font size=2> <select name="county"> <option value="">Choose a county</option> <option value="01ATLANTIC">ATLANTIC</option>
And these are two of the methods I've attempted to get the thing to go:
$browser->form_name( "gs" ); $browser->set_fields( county => '01ATLANTIC' ); $browser->submit(); # $browser->form_name("gs"); # $browser->field( "county", "01ATLANTIC" ); # $browser->cntyzip();
I've tried this in both regular mech and the Win32::ie version, but no luck... Any advice?

In reply to Submitting form data to Javascript form by gebelo

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.