Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number

Re: Clicking nameless buttons with WWW::Mechanize

by PodMaster (Abbot)
on Mar 15, 2005 at 07:38 UTC ( #439563=note: print w/replies, xml ) Need Help??

in reply to Clicking nameless buttons with WWW::Mechanize

I've tried to submit the form using the submit method, but it seems the first form on the page (a website search box) is submitted instead of the login form.
I sort of doubt that can happen
use strict; use WWW::Mechanize; use WWW::Mechanize::FormFiller; use URI::URL; my $agent = WWW::Mechanize->new( autocheck => 1 ); my $formfiller = WWW::Mechanize::FormFiller->new(); $agent->env_proxy(); $agent->follow(''); $agent->get(''); $agent->form(1) if $agent->forms and scalar @{$agent->forms}; $agent->form_number(2); { local $^W; $agent->current_form->value('query', 'WWW::Mechanize'); + }; $agent->submit(); __END__ C:\>perl -MWWW::Mechanize -e"die WWW::Mechanize->VERSION" 1.11_01 at -e line 1. C:\>perl -MWWW::Mechanize::Shell -e shell Module File::Modified not found. Automatic reloading disabled. SetConsoleMode failed, LastError=|6| at C:/Perl/site/lib/Term/ReadKey. +pm line 268. >open Use of uninitialized value in concatenation (.) or string at C:/Perl/s +ite/lib/WWW/ line 1743, <IN> line 1. Can't find any link matching on this page () at C +:/Perl/site/lib/WWW/Mechanize/ line 1028 Can't call method "code" on an undefined value at C:/Perl/site/lib/WWW +/Mechanize/ line 1034, <IN> line 1. >get Retrieving>>>forms Form [1] GET query= (text) <NONAME>= Go (submit) Form [2] GET mode=module (option) [*module/Module|dist/Distr +ibution|author/Author|doc/Documentation] query= (text) <NONAME>=Search (submit) Form [3] POST unickname= (text) returnto=// (hidden readonly) op=userlogin (hidden readonly) upasswd= (password) login_temp=<UNDEF> (checkbox) [*<UNDEF>/off|yes/Public T +erminal] userlogin=Log in (submit)>form 2 GET mode=module (option) [*module/Module|dist/Distr +ibution|author/Author|doc/Documentation] query= (text) <NONAME>=Search (submit)>value query WWW::Mechanize>submit 200>>>scr +ipt

MJD says "you can't just make shit up and expect the computer to know what you mean, retardo!"
I run a Win32 PPM repository for perl 5.6.x and 5.8.x -- I take requests (README).
** The third rule of perl club is a statement of fact: pod is sexy.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://439563]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (4)
As of 2020-06-07 07:38 GMT
Find Nodes?
    Voting Booth?
    Do you really want to know if there is extraterrestrial life?

    Results (42 votes). Check out past polls.