Piotr Polok
2012-Jan-04 06:33 UTC
[Mechanize-users] How to download file after button click with no URL
HI, I''m trying to download file with no success using below code: $mech->get( $search_result ); $mech->form_number( 4 ); $mech->current_form()->click("eksport_do_pliku"); print $mech->res(); This is part of HTML source: " <button type="submit" name="eksport_do_pliku" class="buty" style="margin-left:20px" onclick="document.getElementById(''cod'').value=''2'';"><img src="gfx/przyciski/akceptuj.png" style="vertical-align:middle;margin-right:5px">Eksportuj dane do pliku </button> " The result of "$mech->res();" is "HTTP::Response=HASH(0x8a49d10)" Please help :) -- best regards Piotr Polok
Eric Hodel
2012-Jan-04 07:35 UTC
[Mechanize-users] How to download file after button click with no URL
On Jan 3, 2012, at 10:33 PM, Piotr Polok wrote:> $mech->get( $search_result ); > $mech->form_number( 4 ); > > $mech->current_form()->click("eksport_do_pliku"); > print $mech->res();Assuming you''ve required mechanize, how does this work? Are you using perl mechanize? If so, you''ve got the wrong list as this does not parse on ruby: $ ruby -v - ruby 1.8.7 (2010-01-10 patchlevel 249) [universal-darwin11.0] $mech->get( $search_result ); $mech->form_number( 4 ); $mech->current_form()->click("eksport_do_pliku"); print $mech->res(); ^D -:1: syntax error, unexpected ''>'' $mech->get( $search_result ); ^ -:2: syntax error, unexpected ''>'' $mech->form_number( 4 ); ^ -:4: syntax error, unexpected ''>'' $mech->current_form()->click("eksport_do_pliku"); ^ -:4: syntax error, unexpected ''>'' $mech->current_form()->click("eksport_do_pliku"); ^ -:5: syntax error, unexpected ''>'' print $mech->res(); ^
Piotr Polok
2012-Jan-04 07:44 UTC
[Mechanize-users] How to download file after button click with no URL
On 04.01.2012 08:35, Eric Hodel wrote:> On Jan 3, 2012, at 10:33 PM, Piotr Polok wrote: >> $mech->get( $search_result ); >> $mech->form_number( 4 ); >> >> $mech->current_form()->click("eksport_do_pliku"); >> print $mech->res(); > > Assuming you''ve required mechanize, how does this work? Are you > using perl mechanize? If so, you''ve got the wrong list as this does > not parse on ruby:HI, You are right, sorry! -- br Piotr Polok