[twill] how to access results from "find"-command

Howard B. Golden hgolden at socal.rr.com
Wed Mar 24 16:51:08 PDT 2010

Hi martin

On Wednesday March 24, 2010, martin wrote:

> I've been trying to get it working in python, but without any luck:
> from twill.commands import go, find, echo
> go("http://somepage")
> find("sometext")

Please see http://twill.idyll.org/python-api.html

From that page (note the second sentence):

However, the functions in commands.py are too simple for some 
situations. In particular, they do not have any return values, so in 
order to e.g. get the HTML for a particular page, you will need to talk 
to the actual "Web browser" object that twill uses.

To talk to the Web browser directly, call the get_browser function:

from twill import get_browser
b = get_browser()


This is the second way to use twill from Python, and it is much more 
flexible. All of the functions in commands.py use this same browser 
object, so you can mix and match:

from twill import get_browser
b = get_browser()

from twill.commands import *



More information about the twill mailing list