AxeRuleOptions Class

Link to AxeRuleOptions Class copied to clipboard

Enable or disable specific axe-core rules when configuring the axe Watcher Java integration

Free Trial
Not for use with personal data

The AxeRuleOptions class enables you to configure individual rules for accessibility testing with the axe Watcher Java integration. You can use this class to enable or disable specific accessibility rules when running tests. You use it with the setRules method of AxeRunOptions to specify the rules to enable or disable.

Constructor

AxeRuleOptions()

Creates a new instance of AxeRuleOptions with default settings.

AxeRuleOptions options = new AxeRuleOptions();

Methods

setEnabled(boolean enabled)

Sets whether a rule should be enabled (true) or disabled (false).

Parameters:

  • enabled - boolean indicating whether the rule should be enabled

Returns:

  • AxeRuleOptions - The current instance

Example:

AxeRuleOptions options = new AxeRuleOptions().setEnabled(false);
tip

See the setRules method of AxeRunOptions for an example of using AxeRuleOptions.

getEnabled()

Gets the current enabled state of the rule.

Returns:

  • boolean - The current enabled state

Example:

AxeRuleOptions options = new AxeRuleOptions().setEnabled(true);
boolean isEnabled = options.getEnabled(); // Returns true

toJson()

Serializes the AxeRuleOptions instance to a JSON string.

Returns:

  • String - A JSON string representation of the options

Example:

AxeRuleOptions options = new AxeRuleOptions().setEnabled(false);
String json = options.toJson(); // Returns {"enabled":false}

See Also