[twill] testing forms with twill

Pam Zerbinos pzerbinos at gmail.com
Thu Aug 2 11:55:04 PDT 2007


Hi all,
I'm trying to use twill to test a site that has a huge application form on
it. It's not working particularly well, and I believe I've figured out why.
I'm just not sure what to do about it.

Let's say you need to select your state from a drop-down menu. The html
looks like this:

    <select id="business_mailing_state" name="business[mailing_state]">
        <option value=""></option>
        <option value="AK">Alaska</option>
        <option value="AL">Alabama</option>
        <option value="AR">Arkansas</option>
    </select>

I'm trying to submit the form with no values selected, so I can test the
form errors. However, twill doesn't seem to recognize that first empty
option. If you look at the site in a browser, the drop-down menu is
initially a blank box. In twill, however, it skips the blank box and shows
you the first populated option:

>>> showforms()

Form #1
## ## __Name__________________ __Type___ __ID________
__Value__________________
1     business[mailing_state]  select    business ... ['AK'] of ['AK', 'AL',
'AR', 'AZ', ' ...


I can likely talk to the site developer about putting a value on that first
option ("--" or "Please select" or something similar), but I'm curious if
anyone has other ideas about how to get around this problem. I've tried
using fv to explicitly set the empty string, but that throws
ItemNotFoundErrors.

Thoughts?

thanks much,
pam
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.idyll.org/pipermail/twill/attachments/20070802/f3d75f94/attachment.htm 


More information about the twill mailing list