|Welcome to the Monastery|
Clicking nameless buttons with WWW::Mechanizeby bobf (Monsignor)
|on Mar 15, 2005 at 04:58 UTC||Need Help??|
bobf has asked for the
wisdom of the Perl Monks concerning the following question:
I finally had an occasion to try out WWW::Mechanize, so I eagerly read the docs and started coding. I am somewhat embarassed to admit that I got stuck almost immediately. I am trying to log in, but I can't figure out how to post the form once I've filled it in because the submit button is in a table and it is unnamed.
The source HTML for this form is as follows:
This form is the second form on the page. I confirmed that I had the correct form by doing:
Here is the relevant part of my code (meager, I know):
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 also tried using the click method, but I can't figure out what the name of the button is (using click without specifying the button name also submits the search box instead of the login form).
Since the button is in a table and doesn't appear to have a name, I thought using the optional arguments (x, y coordinates for the button) with the click method, but 1) the name of the button still appears to be required, and 2) I don't know how to determine the button coordinates on the page.
I Googled the net and Super Searched the Monastery's archives, but came up empty. Any ideas?
Thanks in advance!