Canoo Webtest WebTest Canoo

Filter Step applyFilters


Applies one or more filters to the current response and treats the result as if it was a new response.

This step allows you to apply one or more filter(s) to the current response and then perform some simple tests on the result as if the filtered result is a new response.

This step should be treated as experimental. It does a few hacks under the covers but has been very useful for debugging purposes. If you use this step, a recommended approach is to not perform subsequent invokes after this step, i.e. this step should be near the end of your test sequence.


Required? no
The description of this test step.
Required? no
The id of an HTML element. If present, processing will be limited to this element. Will be ignored if a nested table step is used.
Required? no
A shorthand: save='prefixName' is the same as savePrefix='prefixName' saveResponse='true'.
Required? no, default is the 'savePrefix' parameter as specified in <config>.
A name prefix can be specified for making a permanent copy of received responses. A unique number and the file extension (depending on the MIME-Type) will be appended. The resultpath attribute of the <config> element is used for determining the location of the saved result.
Required? no
Whether to make a permanent copy of received responses. Overrides the default value set in the <config> element.
Required? no
An XPath expression identifying an HTML element. If present, processing will be limited to this element. Will be ignored if htmlId is set or if a nested table step is used.

Nested Parameters

Required? yes
A webtest step.
Required? no
To locate a specific cell in a specific table on the page.


The following example illustrates how to use the applyFilters step:

applyFilters example
    <invoke url="testDocBookmarks.pdf"/>
        <pdfToTextFilter mode="groupByLinesdescription="extract PDF text (default mode: normal)"/>
        <lineSeparatorFilter description="normalise line separators"/>
    <verifyText text="Heading Two"/>
    <verifyText text="NEW PAGE"/>

Remember that the resulting filtered response doesn't correspond to what your application is actually producing so keep your usage of this step to a minimum.

See also: the verifyContent, storeDigest, storeLength, lineSeparatorFilter, replaceFilter, tagStripper and contentStripper steps.


Latest build: development
Posted: 19-Jul-2016 17:36

WebTest 3.0 released, featuring upgrades to Java 5, Groovy 1.6, and HtmlUnit 2.4.
The release includes support for maven integration, IDE-integration like for unit tests, capturing of background JavaScript errors, new steps for mouseOver and mouseOut events, better parallel execution of tests and - as usual - lots of handling improvements.
Posted: 5 March 2009

WebTest @ JavaOne
Dierk König presented "Functional testing of web applications: scaling with Java" on Wed May 7, 13:30 at JavaOne 2008 in the Tools and Scripting Languages track.
Posted: 8 May 2008

New WebTest screencast available:
Data Driven WebTest
Posted: 13 November 2007

First WebTest screencast available:
Creating a first Webtest Project

Extend WebTest with Groovy! Groovy in Action is available in every good bookstore.
Groovy in Action
Posted: 29 January 2007