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

martin martinjanz at gmail.com
Wed Mar 24 16:11:31 PDT 2010


hi there,

I've been trying for hours to work with the results from the find-command.

I've got it working more or less in the twill-shell, like so:

go http://somepage.com
find "sometextthatexistsonthatpage"
echo "$__match__"

That will print out exactly "sometextthatexistsonthatpage" as intended.

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")

and now I don't know how to print the results. The manual says about 
find: When called from Python, the matching string is returned.

so I tried print find("sometext") but that prints out "none".
I tried echo("$__match__") but that prints out "$__match__".

How would I do it?

Thanks

mart



More information about the twill mailing list