From the documentation that you linked (emphasis mine):
This allows you to click an element by passing in a CSS selector. This action takes the form click element .
[...]
You can use any valid query selector, including classes and types.
You should be able to use any valid CSS selector, including IDs, classes, and more complex CSS selectors. For example, to click on an element with class="myClass"
you could use:
{
"actions": [
"click element .myClass",
"wait for path to be /foo"
]
}
Running pa11y using the --debug
flag should help you understand if the actions are working correctly. For an example like the one above you should be able to see an output similar to this:
Welcome to Pa11y
> Running Pa11y on URL https://www.example.com/
[...]
> Running actions
> Debug: Running action: click element .myClass
> Debug: ✔︎ Action complete: click-element
> Debug: Running action: wait for path to be /foo
> Debug: ✔︎ Action complete: wait-for-url
> Finished running actions
[...]
> Debug: Document title: "Foo"
No issues found!