Closed toolness closed 7 years ago
I get a different error, but I can reproduce the problem:
VM35:329 Refused to execute inline script because it violates the following Content Security Policy directive: "script-src assets-cdn.github.com". Either the 'unsafe-inline' keyword, a hash ('sha256-Sn4XRHw8EFtG1NWHkQGitqxPHVSvjehPowmi87qhWbQ='), or a nonce ('nonce-...') is required to enable inline execution.
(anonymous)
(anonymous)
(anonymous)
executeAsyncScript @ VM35:329
(anonymous) @ VM35:345
callFunction @ VM35:237
(anonymous) @ VM35:247
(anonymous) @ VM35:248
We should be able to bubble up an error by modifying axe-webdriverjs to use axe.run
internally instead of axe.a11yCheck
. But the browser just hangs in my testing, so we might need to put in a timeout of some kind so it will return the error after a while.
Cool, thanks for the quick response! Would you like me to start working on a PR to fix this?
Oh, sure! That would be awesome. I started changing it myself to validate it would work, that's how I discovered it would probably need a timeout. The relevant source is here: https://github.com/dequelabs/axe-webdriverjs/blob/master/lib/index.js#L113
To make use of axe.run
, the calling function will have to pass another parameter to the callback. You can see the API docs for axe.run
here: https://github.com/dequelabs/axe-core/blob/master/doc/API.md#api-name-axerun
This was addressed with #34 and b6fa546, we'll push an update to npm soon.
Awesome, thanks @marcysutton and @dylanb!
Currently I'm using axe-webdriverjs to operate on third-party sites that I may not control. Some of them, such as github.com, don't seem to like axe-webdriverJS at all:
GitHub error output
I suspect this may be due to Content Security Policy or somesuch, but that's besides the point right now--the main thing I'd like to accomplish is catching that error and e.g. move on to a different site. However, it seems that
axe.analyze()
doesn't have any way of passing an error back to the calling code, and instead ultimately causes the whole node process to crash with this uncaught exception.Is there a way
axe.analyze()
can be modified to e.g. return aPromise
that we can use to catch any errors or something?