Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

puppeteer: failed to inject axe-core into frame #98

Closed
michael-siek opened this issue Oct 8, 2020 · 6 comments
Closed

puppeteer: failed to inject axe-core into frame #98

michael-siek opened this issue Oct 8, 2020 · 6 comments
Assignees

Comments

@michael-siek
Copy link
Member

It looks like there is still no way to prevent axe from injecting into certain iframes

dequelabs/axe-puppeteer#25

@michael-siek
Copy link
Member Author

Ran test with multiple websites with iframes and I can not replicate the issue. Closing this issue, will reopen if this becomes an issue again.

@talldan
Copy link

talldan commented Oct 28, 2020

@michael-siek We're experiencing this currently on WordPress/gutenberg with an iframe.

We tried configuring axe tests to exclude the element (WordPress/gutenberg#26527), but that doesn't seem to work.

FAIL specs/experiments/template-part.test.js (21.868s)
  ● Template Part › Template part placeholder › Should insert template part when preview is selected

    expect(jest.fn()).not.toHaveErrored(expected)

    Expected mock function not to be called but it was called with:
    ["Failed to inject axe-core into frame (about:blank)"],["Failed to inject axe-core into frame (about:blank)"]

It's only intermittently failing, I believe the iframe in question is removed from the DOM as a result of the interaction during the test, so potentially Axe is trying to still inject into a no longer existent element?

@okeul
Copy link

okeul commented Oct 28, 2020

Hi,

Same here, the bug is still here.
iframe

package.json

"@axe-core/puppeteer": "^4.0.0",
"puppeteer": "^5.3.1"

gulpfile.js

(async () => {

  try {
    const browser = await puppeteer.launch({
        ignoreDefaultArgs: ['--disable-extensions'],
        executablePath: process.env.CHROMIUM_PATH,
        args: [
          '--no-sandbox',
          '--disable-setuid-sandbox',
          '--headless',
          '--disable-gpu',
          '--window-size=1920x1080',
          '--disable-dev-shm-usage'
        ]
      }),
      page = await browser.newPage();

    await page.setBypassCSP(true);

	  await page.goto(url, {
	    timeout: 300000 // 5 minutes 
	  });

	  const res = await new AxePuppeteer(page)
	    .disableRules('frame-tested')
	    .analyze()
	    .then(function(res) {
	      console.log(colors.cyan('Running axe validator: ') + url);
	      // stuff
	    })
	    .catch(err => {
	      console.error(colors.red('Error running aXe validator: ', url, '', err.message));
	    })

    await page.close()
    await browser.close()
  } catch (error) {
    console.log(colors.red('Error: That did not go well.'));
    throw error
  }

})().catch(e => { console.error(e) });

@talldan
Copy link

talldan commented Oct 28, 2020

As a side-note, when browsing the code I noticed there is a disableFrame method in axe - #39 is the PR that added it.

That seems to do what this issue originally proposed. I wonder why it's undocumented 🤔

@padmavemulapati
Copy link

Tested on the testpage http://qateam.dequecloud.com/attest/api/test.html
I am seeing the iframe related violation nodes when normally analysed using puppeteer and also when i analysed withTags (wcag2a, wcag2aa etc.,).
for the above test page seeing the violation list as

  1. 1 issue found for "aria-allowed-attr"
  2. 1 issue found for "color-contrast"
  3. 4 issues found for "dlitem"
  4. 2 issues found for "image-alt"
  5. 1 issue found for "label"
    among all "dlitem" and "image-alt" issues are related to iframes

And tested with "disableFrame" -
new AxePuppeteer(page).withTags(['wcag2a', 'wcag2aa']).disableFrame('#testFrame') and analyse,
it successfully disabled the frame nodes and relative issues:
with "disableFrame" the issues listed on testpage http://qateam.dequecloud.com/attest/api/test.html

  1. 1 issue found for "aria-allowed-attr"
  2. 1 issue found for "color-contrast"
  3. 1 issue found for "label"

@michael-siek
Copy link
Member Author

Closing issue resolved

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants