[Chicago-talk] WWW::Mechanize

Andy Lester andy at petdance.com
Fri Apr 2 17:32:30 CST 2004

> Does this get me to the page after the form submit or
> do I still need to press submit?
> $m->submit_form(
> form_number => 1,
> fields => {
> 	user_id       => "user",
> 	password      => "pw",
> 	   },
> );

submit_form() actually does the submit.

> Also when I am at a page on a web site 
> are there commands in mechanize to show me:

You can call $mech->forms() to get a list of the forms.  Mech also
installs (optionally) a tool called mech-dump that shows you all the
forms and fields on the page.

$ mech-dump http://use.perl.org/
GET http://use.perl.org/search.pl
  <NONAME>= Go                    (submit)  

GET http://search.cpan.org/search
  mode=module                     (option)  [*module/Module|dist/Distribution|author/Author|doc/Documentation]
  <NONAME>=Search                 (submit)  

POST http://use.perl.org/users.pl
  returnto=/                      (hidden)  
  op=userlogin                    (hidden)  
  upasswd=                        (password) 
  login_temp=<UNDEF>              (checkbox) [*<UNDEF>/off|yes/Public Terminal]
  userlogin=Log in                (submit)  

GET http://use.perl.org/pollBooth.pl
  qid=17                          (hidden)  
  section=index                   (hidden)  
  aid=<UNDEF>                     (radio)   [1/Web development|2/System administration|3/End-user application development|4/Bioinformatics|5/Data processing|6/More than one of the above|7/Something else]
  <NONAME>=Vote                   (submit)  

It also has flags for all the images and links, too.


Andy Lester => andy at petdance.com => www.petdance.com => AIM:petdance

More information about the Chicago-talk mailing list