Share this page

# TC.addNetworkFilter

Adds a filter for URL requests.

    TC.addNetworkFilter(filters, include, applyTo);

Note:
- This function is only relevant for steps that have a network-related end event, or that do not have any end event.
- You cannot use exclude and include filters at the same time.

## Arguments

Name | Description
--- | ---
filters | (string or RegExp) Filter representing one or more URLs. Separate multiple URLs with a semicolon (;). The URL can include a wildcard (*) which can match 0 or more characters.
include (Optional) | (boolean) Set to true to include URL requests that match the filter; otherwise false (default value).
applyTo (Optional) | Specify the type of request the filter applies to. Possible values: Xhr. Filters XHR requests only. NonXhr. Filters non-XHR requests only. All. Filters all requests (default value).

## Return value

A promise that will be fulfilled with no arguments.

## Example

Copy code

    (async ()=>{
        await TC.addNetworkFilter("http://www.myco.com/*", true, "All");
    })();

Tips to improve your search results... VuGen Function Reference Version 25.1-25.3 Function Reference 25.1-25.3 All View Local Help Center View Online Help Center Version: