[twill] twill form submit question

Titus Brown titus at caltech.edu
Wed Jul 11 08:50:15 PDT 2007

On Fri, Jul 06, 2007 at 11:52:33AM -0700, meiji wang wrote:
-> I have the following form to click in order to submit the seleted
-> items, what is proper command in twill to perform this task?  Thanks a
-> lot!
-> <form
-> name="process_form_2" method="GET">
-> <a
-> href="/patroninfo/1931688/items" onClick="return onClickProcessSome(
-> process_form_2, '/patroninfo/1931688/items', 'renew' )"
-> ><img src="/screens/pat_renewmark.gif" alt=
-> "RENEW SELECTED ITEMS" border="0" /></
-> a>
-> I do not have luck on using tg4wtwill.py to convert the above task in
-> the testgen4web either.

Hi, Meiji,

sorry to take so long to reply...

twill doesn't understand JavaScript, so the short answer is there's no
simple way to do this in twill.

A longer answer: ultimately the form is submitted via HTTP so you could
probably get it to work.  You might have to write your own code to get
it to work.

I have two suggestions for this:

 - first, use an HTTP monitor (I would use scotch, but there are other
   options, like LiveHTTPHeaders for Firefox) to figure out what
   is being submitted over HTTP when you do the click;

 - second, look at


   and read the thread that starts with "Making a POST request without a
   form".  That will tell you how to write Python code to do a submit
   without actually having a form.


scotch: http://darcs.idyll.org/~t/projects/scotch/doc/


More information about the twill mailing list