[TIP] twill question

Terry Peppers peppers at gmail.com
Fri Jan 25 09:26:41 PST 2008


Hi David.

> I've been using Twill quite extensively for the past month or so and
> I love it.

Same here.

> 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.

This probably isn't the most elegant way, but it's a way.

---- START SNIP -----
>>> from twill.commands import *
>>> go("http://www.google.com")
==> at http://www.google.com
'http://www.google.com'

>>> fv(1, "q", "python and twill")
>>> f = get_browser().get_form("f")
>>> f.get_value("q")
'python and twill'
>>>
---- END SNIP -----



More information about the testing-in-python mailing list