Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
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('http://use.perl.org/'); $agent->get('http://use.perl.org/'); $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 http://use.perl.org/ Use of uninitialized value in concatenation (.) or string at C:/Perl/s +ite/lib/WWW/Mechanize.pm line 1743, <IN> line 1. Can't find any link matching http://use.perl.org/ on this page () at C +:/Perl/site/lib/WWW/Mechanize/Shell.pm line 1028 Can't call method "code" on an undefined value at C:/Perl/site/lib/WWW +/Mechanize/Shell.pm line 1034, <IN> line 1. >get http://use.perl.org/ Retrieving http://use.perl.org/(200) http://use.perl.org/> http://use.perl.org/> http://use.perl.org/>forms Form [1] GET http://use.perl.org/search.pl query= (text) <NONAME>= Go (submit) Form [2] GET http://search.cpan.org/search mode=module (option) [*module/Module|dist/Distr +ibution|author/Author|doc/Documentation] query= (text) <NONAME>=Search (submit) Form [3] POST http://use.perl.org/login.pl unickname= (text) returnto=//use.perl.org/ (hidden readonly) op=userlogin (hidden readonly) upasswd= (password) login_temp=<UNDEF> (checkbox) [*<UNDEF>/off|yes/Public T +erminal] userlogin=Log in (submit) http://use.perl.org/>form 2 GET http://search.cpan.org/search mode=module (option) [*module/Module|dist/Distr +ibution|author/Author|doc/Documentation] query= (text) <NONAME>=Search (submit) http://use.perl.org/>value query WWW::Mechanize http://use.perl.org/>submit 200 http://search.cpan.org/search?mode=module&query=WWW%3A%3AMechanize> http://search.cpan.org/search?mode=module&query=WWW%3A%3AMechanize> http://search.cpan.org/search?mode=module&query=WWW%3A%3AMechanize>scr +ipt foo.pl

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.


In reply to Re: Clicking nameless buttons with WWW::Mechanize by PodMaster
in thread Clicking nameless buttons with WWW::Mechanize by bobf

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, 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, 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.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others exploiting the Monastery: (4)
    As of 2020-05-31 06:56 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?
      If programming languages were movie genres, Perl would be:















      Results (173 votes). Check out past polls.

      Notices?