On Wed, Oct 20, 2004 at 01:44:44AM -0400, Guest via RT wrote:
Show quoted text>
> This message about WWW-Mechanize was sent to you by guest <> via rt.cpan.org
>
> Full context and any attached attachments can be found at:
> <URL:
https://rt.cpan.org/Ticket/Display.html?id=6100 >
>
> [mark@summersault.com - Tue Oct 19 22:25:54 2004]:
> > > I'm working against a web page that has multiple forms, but no form
> > > names. The suggested function allows me to find the right form using
> > the field names.
> >
> > I think $mech->form_number() should work for you, then.
> >
>
> Yes that would work. Only problem is the purpose of WEB::Mechanize is
> to make the script as insensitive to site changes as possible. Using
> form numbers (or field numbers for that matter), will break if an extra
> form is added later.
>
> In my code, I search all the forms for a specific field. I think that's
> less sensitive to site changes.
I think this is a reasonable feature to add. Here's one way I
could see it being designed:
We already have two form-discovery methods:
form_name
form_number
##########
I might go so far to to suggest we deprecate these in favor a more
general purpose function "find_form", that would work like "find_link()".
It would support options include
name =>
n =>
number => # alias for 'n'
field_name => # match the first which contains this field name.
The 'number' field could be applied to others, so you can mean:
"find the second form named 'foo'", or "find the second form which
contain fields named 'jones'".
I would use this feature myself, I think. I started putting names in our
forms so I could find them with Mech. However, a lot of times the field
names are unique enough that I could pick out one unique to the form I
want. I have also had times were my Mech script makes because someone
changed the form name thinking it wouldn't make a difference.
We'll get some feedback from other Mech developers and users and come
up with a solution for this. I'm CC'ing our developer list for comment.
Mark
--
http://mark.stosberg.com/