in reply to Using Mechanize to click a button

What can be the problem?

It could be in the code you haven't shown us (hint, hint)

Replies are listed 'Best First'.
Re^2: Using Mechanize to click a button
by dindia (Initiate) on Mar 17, 2011 at 12:21 UTC

    Sorry, here it is

    my $mech = WWW::Mechanize->new(); print "Accessing $url\n"; $mech->get($url); print "Downloading the file..."; $mech->click_button (value => "TAB"); $mech->save_content( $full_path ); print "Done.\n";
    Thanks! output:
    Accessing http://spiedigitallibrary.org/ebooks/spies/kbart?isAuthorize +d=no Downloading the file...Can't call method "header" on an undefined valu +e at /exlibris/sfx_ver/app/perl-5.10.1/lib/site_perl/5.10.1/WWW/Mecha +nize.pm line 2381.
    If I hash out the code related to the button the main mage is saved without problem.

      The WWW::Mechanize documentation says that click_button works on the "current Form", which might be the source of your problem. There's a search form before the form you are interested in.

      So you might need to invest some effort into selecting the right form.

        Thank you moritz! I totally missed this.