dequelabs / axe-webdriverjs

Provides a chainable axe API for Selenium's WebDriverJS and automatically injects into all frames.
Mozilla Public License 2.0
130 stars 46 forks source link

Uncaught exceptions in `lib/index.js` #56

Closed zkf closed 5 years ago

zkf commented 6 years ago

In lib/index.js, there is missing a call to .catch() for the driver.executeAsyncScript() promise chain. When executeAsyncScript throws an exception, it is unhandled and will crash Node.

A fix seems to be to just tag .catch(err => {reject(err)}); onto the executeAsyncScript() promise chain in lib/index.js.

marcysutton commented 6 years ago

IIRC we left that off so you wouldn't need a catch statement in your tests. But maybe @WilcoFiers remembers more about that.

dennisreimann commented 6 years ago

I ran into this as well. The error seems to occur as part of a race condition in case the driver is not instantiated per test, but reused across multiple tests.

so you wouldn't need a catch statement in your tests

If so, axe should handle these errors internally and maybe log out a warning that i.e. the driver is not supposed to be reused. What are your thoughts on this?

stephenmathieson commented 6 years ago

Opened #79 to resolve this. Unfortunately it requires a breaking change to the callback-based API, so we may have to wait a bit for it to land.

Opened #83 which solves this without a breaking change.