Exclude Rule
The Exclude rule is useful if you want to filter out requests from particular scripts without removing them from the recording, or if you want to filter out requests based on criteria other than the host to which the request was sent.
Alternately, read the Filtering hosts topic to see if you can filter requests out of the recording before the script generation process.
Example Script Code Changes (Java)
The following example code shows the effect of applying an Exclude rule:
Url url1 = new Url(protocol1, httpbin, "/");
try (Request request1 = getWebBrowser().createRequest(HttpMethod.GET, url1))
{
request1.setHeader("Accept-Charset", "utf-8");
try (Response response1 = request1.send())
{
....
}
}
Url url2 = new Url(protocol1, httpbin, "/");
try (Request request2 = getWebBrowser().createRequest(HttpMethod.GET, url2))
{
try (Response response2 = request2.send())
{
....
}
}
Changes to the following:
// Exclude request 1 based on Accept-Charset header
Url url2 = new Url(protocol1, httpbin, "/");
try (Request request2 = getWebBrowser().createRequest(HttpMethod.GET, url2))
{
try (Response response2 = request2.send())
{
....
}
}
Generation Rules Wizard pages
Create Request Filter
Since the purpose of this rule is to exclude requests from the generated script, the only information required is which requests to exclude. These can be described by creating a request filter on the common Create Request Filter page.
After the Create Request Filter page, the common Rule name and summary page appears.