Lawliet has asked for the wisdom of the Perl Monks concerning the following question:

Is there anyway for LWP to get() the page that WWW::Mechanize is currently on while browsing an aspx page?

Here is the backstory:

The site I am accessing is http://www.example.com. However, when I have Mech click on link, it brings me to http://www.example.com/test.aspx. There is a form on that page with a submit button that, when pressed, brings me to the next page of the form (with another submit bringing me to another page of the form, and so on). The problem lies at this stage. The url stays the same. This troubles me because I do not know how to parse the form of the new pages.

Any and all help appreciated.

EDIT: Please note I need LWP:UserAgent and HTML:Form to find what type of fields are in the form, then use Mech to fill them out. If there is a more efficient way to do this, please, do tell.

Replies are listed 'Best First'.
Re: LWP parsing problem
by Fletch (Bishop) on Jul 05, 2008 at 04:49 UTC

    Erm, $mech->content returns the content of the "current" (i.e. last fetched) page. Wouldn't that be what you want?

    The cake is a lie.
    The cake is a lie.
    The cake is a lie.

      Ah. Forgot to include some details. I am using HTML::Form and LWP::UserAgent (as well as Mech, of course) to fill out the form. I need HTML::Form to determine what kind of field it is then fill it in accordingly. Then use mech to continue the form.

        To expand a bit on what our nameless member has said, the WWW::Mechanize documentation shows many methods to access the forms on the current page and also many methods to fill out fields in those forms. Under the hood, WWW::Mechanize also uses HTML::Form, but why do you want to reimplement what WWW::Mechanize does if you're already using WWW::Mechanize?

        Just stick with mechanize. You generally need to show more details than that.