views:

66

answers:

1

I'm using WWW::Mechanize to retrieve a form from a webpage:

#!/usr/bin/perl

use WWW::Mechanize;

my $mechanize = WWW::Mechanize->new();

$mechanize->proxy(['http', 'ftp'], 'http://proxy/');

$mechanize->get("http://www.temp.com/");

$mechanize->form_id('signin');

The website HTML has code as follows

<form action="https://www.temp.com/session" id="signin" method="post">

but I get the error

 There is no form with ID "signin" at SiteScraper.pl

What do I do?

A: 

Without knowing exactly could be wrong, you might try to output whatever forms that WWW::Mechanize is able to find in the response by using:

use Data::Dumper;
print Dumper($mechanize->forms());

It should output all the forms and their respective attributes etc.

Double check that the form is in the dump, otherwise something is wrong. Then check that the form's ->{attr}->{id} is what you expect as well.

You can also try to select the form using another way, e.g. by name, and see if that helps.

myme