axe-core-npm
axe-core-npm copied to clipboard
Axe puppeteer hangs when JS is disabled
Product: puppeteer
Expectation: I tried to make it work with Javascript disabled on the page, and the analyze function just hangs, i dont know if this is wanted/expected behavior of if there is a way to make it work, or improve the error handling?
Actual: It hangs with Js disabled on the page Motivation: from what i know, we only read the dom and see if the elements answer some rules. why do we need js to make it work. It also helps save some time because it renders the page from the server only.
import { AxePuppeteer } from '@axe-core/puppeteer';
import puppeteer from 'puppeteer';
(async () => {
const browser = await puppeteer.launch();
const page = await browser.newPage();
await page.setBypassCSP(true);
await page.setJavaScriptEnabled(false);
await page.goto('https://dequeuniversity.com/demo/mars/');
console.log('before results');
const results = await new AxePuppeteer(page).analyze();
console.log(results);
await page.close();
await browser.close();
})();
@axe-core/[email protected]
- Node version: 16.15.1
- Platform: Linux
I read the code a little bit, it looks like the package runs JS inside the page, so maybe it should be documented?
Yes, all of our integrations run axe-core on the page you are analyzing, which requires JavaScript to be enabled on the page. We'll look at improving our documentation to better describe things.
As we are running javascript enabled scripts, issue trying is expected.
Validated with the latest axe-core/puppeteer@ 4.5.3-alpha.357 and [email protected] , with the caveat, await page.setJavaScriptEnabled(false); we are unable to do execution.

Enhancement suggested: It is good if it display any warning message and quit from the execution