in reply to Re^2: mechanize bug - is there a workaround?
in thread mechanize bug - is there a workaround?

How do I tell my version of libwww-perl?

Check the version of the module LWP

$ perl -MLWP -e 'print "$LWP::VERSION\n"' 5.805

and, just to be sure, also check HTML::Form (part of the bundle), as I suspect the problem could have originated in that module (Update: this doesn't make much sense, though — as the revision control timestamp of the respective file dates back to 2005/12/07 :).  Mine shows 1.0.54.

I wonder what I am doing different from you.

No idea :)  Here's what I did:

use WWW::Mechanize; my $mech = WWW::Mechanize->new(); my $url = "file:///.../test.html"; # the mentioned form $mech->get($url); $mech->current_form->dump(); $mech->set_fields( '__EVENTTARGET' => 'mynewvalue' ); $mech->current_form->dump();

which gives:

$ ./674272.pl POST .../Browse.aspx?MyToken=632797078501515540 [aspnetForm] __EVENTTARGET= (hidden readonly) __EVENTARGUMENT= (hidden readonly) __VIEWSTATE=/wEPDwUJ (hidden readonly) POST .../Browse.aspx?MyToken=632797078501515540 [aspnetForm] __EVENTTARGET=mynewvalue (hidden readonly) __EVENTARGUMENT= (hidden readonly) __VIEWSTATE=/wEPDwUJ (hidden readonly)

Replies are listed 'Best First'.
Re^4: mechanize bug - is there a workaround?
by rouble (Initiate) on Mar 17, 2008 at 03:45 UTC
    almut,

    I tried what you did, and I got the same result. You were right this defect has been fixed.

    After some investigation, I realized that the web server was sending different html depending on the user agent. Without setting a user agent the html did not include __EVENTTARGET and __EVENTARGUMENT. So I set my user agent to windows, as follows:
    $mech->agent_alias("Windows IE 6");
    This fixed the problem. Thanks for setting me on the right track!

    tia, rouble
      Hi can you share the complete code to workaround dopostback .NET method ? visuss at gmail Thanks