[twill] twill question

Titus Brown titus at caltech.edu
Mon Sep 12 14:04:12 PDT 2005


-> twill is a great tool! 
-> 
-> I'm hoping to migrate our entire web testing approach to it. 

glad to hear it!  be sure to check out some of the alternatives; there's
a javascript-based approach that may work if you're running a supported
server.  It's called Selenium, and people seem to like it.

-> There is one issue that I was unable to figure out yet. How could I
-> submit a value at a certain index of a select widget.  The problem is
-> that I don't know beforehand what the content will be so I can't fill
-> that in beforehand. I realize that this functionality is a bit odd one
-> so it might not be supported right now, but if I wanted to add this
-> functionality where do you think it would be best place to start
-> hacking?

Right.  If I understand this, you basically want to set up a variable
substitution, right?

Or, in python,

--
val = figure_out_value()
web_page.set_select_widget(val)
--

This can be easily added in via extension module.  Basically, write the
function figure_out_value() and have it store the value in a variable
named something like __myvalue__.

Then

	fv 1 selectwidget __myvalue__

will set selectwidget to the value of __myvalue__.

Check out the twill/commands.py, getinput() function for an example of
how to fiddle with __variables__ in the twill namespaces.

You can also look at examples/extend_example.py to see how to write your
own extension function.

Does that make sense?

cheers,
--titus



More information about the twill mailing list