How to configure rules for wcag2aa in axe-core for selenium java

两盒软妹~` 提交于 2021-01-29 07:18:08

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!