如何在 com.deque.html.axe-core for selenium java 中配置 wcag2aa 的可访问性规则
How to configure accessibility rules for wcag2aa in com.deque.html.axe-core for selenium java
我需要用wcag2aa
分析网络驱动程序。
我正在使用以下依赖项。
<dependency>
<groupId>com.deque.html.axe-core</groupId>
<artifactId>selenium</artifactId>
<version>4.2.2</version>
</dependency>
我的辅助功能验证方法如下。
在此方法中,result
对象没有任何违规(违规列表为空)并且可以看到具有 wcag2aa
标记值的不适用列表。
需要知道这个方法有什么问题。
public void checkAccessibility() {
AxeRunOnlyOptions runOnlyOptions = new AxeRunOnlyOptions();
runOnlyOptions.setType("tag");
runOnlyOptions.setValues(Arrays.asList("wcag2a", "wcag2aa"));
AxeRunOptions options = new AxeRunOptions();
options.setRunOnly(runOnlyOptions);
AxeBuilder axe = new AxeBuilder().withOptions(options);
Results result = axe.analyze(getWebDriver());
List<Rule> violationList = result.getViolations();
System.out.println("Violation list size :"+result.getViolations().size());
System.out.println("Inapplicable list size :"+result.getInapplicable().size());
}
任何人都可以帮助我为什么即使页面有 wcag2aa
个违规,违规列表也变成空的?
根据我的理解,result.getViolations()
和 result.getInapplicable()
是两种不同的东西,都会产生不同的结果。
It might happened that the violation is not present but there are
some rules for which no matching elements were found on the page.
结果对象
作为 axe.run 的第三个参数传入的回调函数在结果对象上运行。
这个对象有四个组成部分 – a passes array, a violations array, an incomplete array and an inapplicable array.
1) passes 数组 跟踪所有通过的测试,以及每个测试的详细信息。这可以提高测试效率,尤其是与手动测试结合使用时,因为用户可以轻松找出已经通过了哪些测试。
result.getPasses()
2) violations 数组跟踪所有失败的测试,以及每个测试的详细信息。
result.getViolations()
3) 不完整的数组(也称为“审查项目”)表示哪些节点既不能确定最终通过也不能确定最终失败。它们被分开,以便用户界面可以将它们显示给用户以供手动审查(因此称为“审查项目”)。
result.getIncomplete()
4) 不适用的数组列出了页面上没有找到匹配元素的所有规则。
result.getInapplicable()
参考:https://www.deque.com/axe/core-documentation/api-documentation/
我需要用wcag2aa
分析网络驱动程序。
我正在使用以下依赖项。
<dependency>
<groupId>com.deque.html.axe-core</groupId>
<artifactId>selenium</artifactId>
<version>4.2.2</version>
</dependency>
我的辅助功能验证方法如下。
在此方法中,result
对象没有任何违规(违规列表为空)并且可以看到具有 wcag2aa
标记值的不适用列表。
需要知道这个方法有什么问题。
public void checkAccessibility() {
AxeRunOnlyOptions runOnlyOptions = new AxeRunOnlyOptions();
runOnlyOptions.setType("tag");
runOnlyOptions.setValues(Arrays.asList("wcag2a", "wcag2aa"));
AxeRunOptions options = new AxeRunOptions();
options.setRunOnly(runOnlyOptions);
AxeBuilder axe = new AxeBuilder().withOptions(options);
Results result = axe.analyze(getWebDriver());
List<Rule> violationList = result.getViolations();
System.out.println("Violation list size :"+result.getViolations().size());
System.out.println("Inapplicable list size :"+result.getInapplicable().size());
}
任何人都可以帮助我为什么即使页面有 wcag2aa
个违规,违规列表也变成空的?
根据我的理解,result.getViolations()
和 result.getInapplicable()
是两种不同的东西,都会产生不同的结果。
It might happened that the violation is not present but there are some rules for which no matching elements were found on the page.
结果对象 作为 axe.run 的第三个参数传入的回调函数在结果对象上运行。
这个对象有四个组成部分 – a passes array, a violations array, an incomplete array and an inapplicable array.
1) passes 数组 跟踪所有通过的测试,以及每个测试的详细信息。这可以提高测试效率,尤其是与手动测试结合使用时,因为用户可以轻松找出已经通过了哪些测试。
result.getPasses()
2) violations 数组跟踪所有失败的测试,以及每个测试的详细信息。
result.getViolations()
3) 不完整的数组(也称为“审查项目”)表示哪些节点既不能确定最终通过也不能确定最终失败。它们被分开,以便用户界面可以将它们显示给用户以供手动审查(因此称为“审查项目”)。
result.getIncomplete()
4) 不适用的数组列出了页面上没有找到匹配元素的所有规则。
result.getInapplicable()
参考:https://www.deque.com/axe/core-documentation/api-documentation/