[twill] Twill vs. AJAX, Twill vs. popups questions
titus at caltech.edu
Mon Mar 20 10:06:10 PST 2006
On Sun, Mar 19, 2006 at 04:59:11PM -0500, Hancock, David (DHANCOCK) wrote:
-> I'm trying to write a twill script that fills in some form values and
-> submits the form. There are two things currently that stymie me:
-> 1. The form page gets some of its form fields populated by AJAX
-> 2. The page that results from successful submission is a popup "above"
-> the original page.
-> Item 1 seems to mean that I can't enter form values directly. For
-> example, I need to pick an aircraft, and then an AJAX request later, a
-> second pulldown of aircraft configurations becomes available. I don't
-> know how to make that request happen in Twill, and if I simply try
-> entering the form values directly, there's an error message (because the
-> form doesn't know about them). So I'm a little stuck there.
Right, that makes sense. There are two possible solutions:
* first, I can add in something that lets you assign values that
aren't actually present in the list. (This would presumably work
something like the 'make readonly controls writeable' flag; you'd
say 'let me add new list values' and then fill it in.) This is easy
to do and I can do it tonight.
* the other solution -- and this is probably less general, but should
be useful for testing -- is to write something that lets you do an
asynchronous HTTP call and fill in the fields with the results.
Does anyone else see a general purpose use for the 2nd option?
-> Maybe I shouldn't worry about Item 2 yet, but if I get Item 1 solved,
-> then I need to be able to follow the processing to the popup page for
-> further work. I haven't found a way to do this yet even in a simple case
-> (basic form, fill in fv fields, submit 0).
hmm. Have you looked into using the 'formaction' command to change the
URL to which the form is post'ed? Or does this work some other way?
-> Before I get too far along, I'd like to know if either of these actions
-> are feasible in twill, or if I have to move to Selenium to handle them.
The short answer is that you'll need to use *some* sort of hack to work
around these issues. It seems possible in the first case, but I'm not
sure how to handle the second case.
More information about the twill