Custom Policies are a powerful feature in DubBot. They can be used in many ways to add to your Web Governance checks. In this article we will explore what each setting in the Rules Panel of the Custom Policy Creator tool does, and how it affects the outcome of the Policy.
Table of Contents
Search By
This setting determines what criteria the policy will use to perform the query. The options include Word or Phrase, Link Text, Link URL, CSS Selector, XPath, and regular Expression. Each criteria comes with its own set of Rule Options that help fine-tune the query.
Rule
The Rule setting is the query itself. This is where you will type the string, name, or expression that will be used to search and match the XML/HTML document. These can vary widely depending on what the user would like to accomplish with the Custom Policy.
Rule Options
Some Search Criteria will come with a dropdown for Rule Options. These are additional settings or parameters used to calibrate the search or matching behaviors. For example, the Link URL search criteria gives you the additional option to set how the Rule is applied in the query. The options in this case are Equals, Starts With, Ends With, and Contains.
Case Sensitivity
Case Sensitivity can be set to Case Sensitive or Ignore Case. How users determine what this setting should be depends heavily on the goals of the Custom Policy.
Page Content Check Behavior
For the Search Criteria Word or Phrase and Regular Expression users are given the choice between searching only the text on the page or searching the source code in addition to the text on the page. Again, this depends on what the user is trying to accomplish with the Custom Policy, but take into consideration that not all user-facing text is visual, including content that is marked up as Screen Reader Only.
Rule Matching Behavior
The Rule Matching Behavior setting determines whether Pages that match the rule as a whole are flag, or Pages that do not match the rule as a whole are flagged.
Adding Multiple Rules
At the bottom of the Rules Panel, users are given the option to add additional Rules. There are some nuances to consider with the way this affects the outcome of the Policy. Each Rule within a Policy will be applied to the entire Document separately. Their matching behavior will not be affected by other Rules within the same Policy. If you want to apply several parameters to match a single element, you would craft a single Rule that contains all of the parameters.
For example, if the intent of the Policy is to match <a>
tags that contain an email address but do not contain a mailto:
attribute, you would use XPath and put BOTH of those parameters into one expression. Alternatively, if you created the policy with two rules, one to match emails and one to match missing mailto: attributes, the Policy will apply those rules independently and your results will not reflect the original intent of the Policy.
Check out our article on Custom Policy Examples to get demonstrations of specific use cases for Custom Policies and how the Rule Settings would be applied.
If you have questions, please reach out to our DubBot Support team via email at help@dubbot.com or via the blue chat bubble in the lower right corner of your screen. We are here to help!