问题
I want to add rules in axe in selenium for wcag2aa. Can anyone help me with the syntax?
JSONObject responseJSON = new AXE.Builder(getBrowser()
.getWebDriver(), scriptUrl).options(
("{ rules: { 'wcag2aa' } }")).analyze();
I have tried the above code but it is giving me exception
Thanks.
回答1:
wcag2aa is a list of rules and not a rule itself.
Try:
.options("{ runOnly: ['wcag2aa'] }")
Or you can only run multiple lists of rules like so:
.options("{ runOnly: ['wcag2a', 'wcag2aa', 'best-practice'] }")
In this case the only list of rules that would not run is the 'section508' list.
Check out the Axe API docs on the options parameter
来源:https://stackoverflow.com/questions/52886928/how-to-configure-rules-for-wcag2aa-in-axe-core-for-selenium-java