Skip to content
This repository was archived by the owner on Mar 19, 2021. It is now read-only.
This repository was archived by the owner on Mar 19, 2021. It is now read-only.

AxeInjector hangs when provided invalid "include" elements #158

@juliannalangston

Description

@juliannalangston

If I have axe-core running on a website, and I try to run it with a context like window.axe.run("#elementThatDoesntExist"), an error is printed to the console.
However, if I am using axe-webdriverjs, and I try to call this, then my code just hangs:

await axeBuilder(myDriver)
 .include("#elementThatDoesntExist")
 .analyze("My title");

The error message never gets surfaced.

I found that, on axe-webdriverjs/lib/index.js:159, there's this code:

 window.axe
 .run(context || document, options || {})
 .then(arguments[arguments.length - 1]);

Since this is invoked inside a driver.executeAsyncScript function, the only way to exit that script is to call arguments[arguments.length - 1]. However, if an error is thrown while running window.axe.run, there is nothing to catch that error, so driver.executeAsyncScript doesn't actually exit, unless some kind of timeout forces it to exit.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions