[twill] Ignoring markup when finding text

Michael Hope michaelh at juju.net.nz
Tue Jul 11 01:08:15 PDT 2006

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?

-- Michael

More information about the twill mailing list