[twill] Ignoring markup when finding text
Titus Brown
titus at caltech.edu
Tue Jul 11 08:21:46 PDT 2006
On Tue, Jul 11, 2006 at 08:08:15AM +0000, Michael Hope wrote:
-> I've just started using twill to test a django based app, and was wondering
-> how to handle basic text tests.
->
-> I'd like to assert on what the user sees, not the HTML. For example
-> the app has a 'Log in to post comments' sentance with a anchor around the
-> words 'Log in'. The test will be more robust and easier to read if I can
-> search for the plain text instead of the text with mark up.
->
-> I made a quick change to 'find' to search a version of the page with all
-> tags and newlines stripped out and it worked well. I was thinking about
-> making this an option just like the current regex options. It's a bit messy
-> as you'd be mixing option classes but not too bad.
->
-> How do you people handle this?
Hi, Michael,
good question ;). I've been thinking about adding an option to 'show'
that strips all of the tags, e.g.
show --text
and this idea of yours fits pretty well. I'd worry about handling
things like newlines -- what if 'show --text' wraps the line "Log in\nto
post comments"? Any thoughts?
cheers,
--titus
More information about the twill
mailing list