Issue
So, I am trying to figure out the accessibility testing using Axe-core with Selenium. Axe-core look promising but I am stuck in one place.
I wants to run the test with specific tags like wcag2a, wcag2aa. By looking at their api documentation page - https://www.deque.com/axe/axe-for-web/documentation/api-documentation/, it is clear that we have to pass values something like
axe.run(
{
runOnly: {
type: 'tag',
values: ['wcag2a', 'wcag2aa']
}
},
(err, results) => {
// ...
}
);
But the problem is I am writing my test in Java and how can we pass this to the code. I looked into the code of their Java sample project https://github.com/dequelabs/axe-selenium-java but there it has not mentioned anything about how to pass these argument.
I did lots of rnd around it and tried code like given below but getting error
org.openqa.selenium.JavascriptException: javascript error: axe.run arguments are invalid
JSONObject responseJSON = new AXE.Builder (driver, scriptUrl)
.options("axe.run({ runOnly: ['wcag2a', 'wcag2aa'] },(err, results)=>{});").
analyze();
I also tried the solution mentioned in the How to configure rules for wcag2aa in axe-core for selenium java but though that solution is not throwing any error but it is showing the results for tags which are not there in the list.
Any help is appreciated. Thanks.
Solution
So, I got the answer from portal https://gitter.im/dequelabs/axe-core#. Posting it here for others.
JSONObject responseJSON1 = new AXE.Builder(driver, scriptUrl).options("{runOnly:
['wcag2a', 'wcag2aa']}").analyze();
Answered By - Naseem
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.