If you don’t need to download certain elements, e.g. images, flash, CSS, during monitoring or you wish to filter out elements that return errors, you can enable network filters and add filter rules to a script. There are two main types of filtering rules:
- Ignore elements corresponding to a mask (Deny)
- Download elements only corresponded to a mask (Allow)
To add a new network filter, from the script context menu, select Network > Filter, and select one from the available options.
Provides a way to conveniently add a general filtering option:
- Default Action – determines if all elements will be filtered or allowed by default.
- Allow – the field contains a mask for elements that will be allowed. If the Default Action is set to DenyAll, only elements listed in this field will be allowed to download.
- Deny – the field contains a mask for elements that must be filtered out. If the Default Action is set to AllowAll, only elements listed in this field will be ignored while loading the page.
Provides the following options:
- Allow – the field contains a mask for all elements that must be allowed.
- Deny – the field contains a mask for all elements that must be filtered out.
- Clear – adds the point that clears previously set filtering rules.
Filtering by Specific Elements
Specific filtered elements should be similar to the following within your script:
Ignore Traffic Only from a Specific Domain
To filter out only traffic from a specific domain, use the Deny option and specify the domain name:
To set up a filter for a root domain, specify the domain name without the host server label (e.g., specify mydomain.com, not www.sub.mydomain.com).
Note, that if you filter out by a subdomain, it does not exclude other subdomains on the same top-level domain, or the top-level domain itself. For example, if you select to filter out *sub.mydomain.com*, the system will still download elements from mydomain.com and userauth.thisdomain.com.
Allow Traffic Only from a Specific Domain
By default, all elements are allowed. To allow only traffic from a specific domain, first set up a network filter to deny all traffic. Then allow a domain you want to monitor. To do this:
- Go to Network Filter > Advanced > Deny and set it to “*”. Save the filter.
- In the next line, add Network Filter > Advanced >Allow and specify the domain to download elements from. Save the filter.
NetworkFilter.Deny ("*"); NetworkFilter.Allow ("*mydomain.com*");
Ignore Specific Elements from an Allowed Domain
If you want to allow traffic from a specific domain, but at the same time filter out some elements from that domain, go to Network Filter > Config, set Default Action to DenyAll, and specify the domain name in the Allow field. Then, to filter out unwanted elements from the allowed domain, specify those elements in the third parameter:
NetworkFilter.Config (NetworkPermissions.DenyAll, "*mydomain.com*", "http://www.mydomain.com/folderpath/images");