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

Runtime issue: axe run throws error 'No elements found for include in page Context' when --include not provided #4558

Open
1 task done
terryknowlton opened this issue Aug 8, 2024 · 3 comments

Comments

@terryknowlton
Copy link

Product

axe-core

Product Version

4.9.1

Latest Version

  • I have tested the issue with the latest version of the product

Issue Description

Attempting to execute a run request against https://stg1.webassessor.com/wa.do results in an error indicating there are 'No elements found for include in page Context' when it is run without an --include option. When the request is run with --include html the accessibility results are returned as expected.

Fails

axe https://stg1.webassessor.com/wa.do

Passes

axe --include 'html' https://stg1.webassessor.com/wa.do

Expectation

Successfully returns the accessibility results for the page when only the url is provided without an --include argument

Actual

Results in the below error

terry@terry-p1:~$ axe https://stg1.webassessor.com/wa.do
Running axe-core 4.9.1 in chrome-headless

Testing https://stg1.webassessor.com/wa.do ... please wait, this may take a minute.
Error: JavascriptError: javascript error: No elements found for include in page Context
  (Session info: chrome-headless-shell=127.0.6533.99)
    at Object.throwDecodedError (/home/terry/.nvm/versions/node/v18.18.2/lib/node_modules/@axe-core/cli/node_modules/selenium-webdriver/lib/error.js:521:15)
    at parseHttpResponse (/home/terry/.nvm/versions/node/v18.18.2/lib/node_modules/@axe-core/cli/node_modules/selenium-webdriver/lib/http.js:514:13)
    at Executor.execute (/home/terry/.nvm/versions/node/v18.18.2/lib/node_modules/@axe-core/cli/node_modules/selenium-webdriver/lib/http.js:446:28)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Driver.execute (/home/terry/.nvm/versions/node/v18.18.2/lib/node_modules/@axe-core/cli/node_modules/selenium-webdriver/lib/webdriver.js:740:17)
    at async AxeBuilder.runPartialRecursive (/home/terry/.nvm/versions/node/v18.18.2/lib/node_modules/@axe-core/cli/node_modules/@axe-core/webdriverjs/dist/index.js:480:27)
    at async AxeBuilder.analyzePromise (/home/terry/.nvm/versions/node/v18.18.2/lib/node_modules/@axe-core/cli/node_modules/@axe-core/webdriverjs/dist/index.js:439:18) {
  remoteStacktrace: '#0 0x5cfc81f636ba <unknown>\n' +
    '#1 0x5cfc81c33730 <unknown>\n' +
    '#2 0x5cfc81c395c1 <unknown>\n' +
    '#3 0x5cfc81c3b4e3 <unknown>\n' +
    '#4 0x5cfc81cc50ee <unknown>\n' +
    '#5 0x5cfc81ca5a52 <unknown>\n' +
    '#6 0x5cfc81cc41ca <unknown>\n' +
    '#7 0x5cfc81ca57f3 <unknown>\n' +
    '#8 0x5cfc81c75ec9 <unknown>\n' +
    '#9 0x5cfc81c7691e <unknown>\n' +
    '#10 0x5cfc81f299eb <unknown>\n' +
    '#11 0x5cfc81f2d972 <unknown>\n' +
    '#12 0x5cfc81f16e15 <unknown>\n' +
    '#13 0x5cfc81f2e502 <unknown>\n' +
    '#14 0x5cfc81efbd2f <unknown>\n' +
    '#15 0x5cfc81f52578 <unknown>\n' +
    '#16 0x5cfc81f52750 <unknown>\n' +
    '#17 0x5cfc81f6248c <unknown>\n' +
    '#18 0x77fa72694ac3 <unknown>\n'
}
Please report the problem to: https://github.com/dequelabs/axe-core-npm/issues/

How to Reproduce

Can be reproduced by running from the command line

axe https://stg1.webassessor.com/wa.do

Additional context

OS: ubuntu 22.04
Node: 18

@terryknowlton terryknowlton added the ungroomed Ticket needs a maintainer to prioritize and label label Aug 8, 2024
@straker
Copy link
Contributor

straker commented Aug 8, 2024

Thanks for the issue. It looks like the problem is a JavaScript file on the page that overrides native JavaScript functions. In this case window.Node is not the native implementation but comes from the common.js file (line 355, function Node). This causes our code to not be able to run correctly.

To fix it you'll need to not have the file add the function to the global scope by either changing the name of the function or probably the most robust solution would be to not have the file add any of the functions to the global scope to prevent accidentally overriding native JavaScript functions.

@straker straker removed the ungroomed Ticket needs a maintainer to prioritize and label label Aug 8, 2024
@terryknowlton
Copy link
Author

terryknowlton commented Aug 8, 2024

Thanks for the issue. It looks like the problem is a JavaScript file on the page that overrides native JavaScript functions. In this case window.Node is not the native implementation but comes from the common.js file (line 355, function Node). This causes our code to not be able to run correctly.

To fix it you'll need to not have the file add the function to the global scope by either changing the name of the function or probably the most robust solution would be to not have the file add any of the functions to the global scope to prevent accidentally overriding native JavaScript functions.

@straker Thank you for the details and steps to work around the issue. Unfortunately this is a client's application and I am not certain what access they have to make modifications. I will relay the suggestion and try to work with them to get their application updated. I'm assuming because they are overriding the global scope there isn't much else that can be done within the axe implemenation?

@straker
Copy link
Contributor

straker commented Aug 8, 2024

That is correct, once globals are overridden there's not much we can do.

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

2 participants