[TIP] twill question

Titus Brown titus at caltech.edu
Mon Jan 28 17:27:14 PST 2008


On Fri, Jan 25, 2008 at 11:17:00AM -0800, Brent Pedersen wrote:
-> > >> I was just wondering, is there was a way to pull a field value
-> > >> directly from a form? I know you can use showforms() to view all
-> > >> available forms, but I really need to grab each field name from the
-> > >> form individually so my Python program can determine what type of
-> > >> info it should pass to each field.
->
-> hi, i think this is what you want.
-> 
-> import twill.commands as tc
-> b = tc.get_browser()
-> tc.go("http://www.google.com")
-> forms = tc.showforms()
-> form = forms.next()
-> names = [control.name for control in form.controls]
-> print names

Yep.  Do people wants this to be formalized in an internal API?  Right
now I don't have much in there for manipulating forms, AFAIK...

cheers,
--titus



More information about the testing-in-python mailing list