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

Error: Cannot read property 'replace' of undefined #649

Closed
riccardolinares opened this issue May 24, 2022 · 4 comments
Closed

Error: Cannot read property 'replace' of undefined #649

riccardolinares opened this issue May 24, 2022 · 4 comments

Comments

@riccardolinares
Copy link

Expected behaviour

I am scanning the website https://www.paramount.com/about but I am getting an error.

Actual behaviour

error Error: Evaluation failed: TypeError: Cannot read property 'replace' of undefined
at Object.processFormControls (puppeteer_evaluation_script:32:285003)
at Object.process (puppeteer_evaluation_script:32:280173)
at m (puppeteer_evaluation_script:32:288962)
at c (puppeteer_evaluation_script:32:288568)
at Object.c.run (puppeteer_evaluation_script:32:287951)
at puppeteer_evaluation_script:32:286810
at puppeteer_evaluation_script:32:287071
at h (puppeteer_evaluation_script:32:289574)
at puppeteer_evaluation_script:32:289615
at a (puppeteer_evaluation_script:32:289700)
at ExecutionContext._evaluateInternal (C:\Users\linar\Desktop\accessibility\node_modules\pa11y\node_modules\puppeteer\lib\cjs\puppeteer\common\ExecutionContext.js:221:19)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async ExecutionContext.evaluate (C:\Users\linar\Desktop\accessibility\node_modules\pa11y\node_modules\puppeteer\lib\cjs\puppeteer\common\ExecutionContext.js:110:16)
at async runPa11yTest (C:\Users\linar\Desktop\accessibility\node_modules\pa11y\lib\pa11y.js:87:18)
at async C:\Users\linar\Desktop\accessibility\node_modules\p-timeout\index.js:50:13

Steps to reproduce

Run a test on this website: https://www.paramount.com/about

Environment

System:
OS: Windows 10 10.0.19044
CPU: (4) x64 Intel(R) Core(TM) i7-3537U CPU @ 2.00GHz
Memory: 1.19 GB / 7.45 GB
Binaries:
Node: 16.4.0 - C:\Program Files\nodejs\node.EXE
Yarn: 1.22.17 - ~\AppData\Roaming\npm\yarn.CMD
npm: 8.9.0 - C:\Program Files\nodejs\npm.CMD
pa11y: 6.2.3

@riccardolinares
Copy link
Author

Solved. It was not related to Pa11y.

@simonhudson
Copy link

simonhudson commented Sep 29, 2022

Hey @riccardolinares, sorry to resurrect a dead thread, but would you mind sharing your solution for this please? I'm having a similar issue when running pa11y 6.2.3. I suspect it's a Puppeteer issue, but could use a point in the right direction. Thanks in advance.

@riccardolinares
Copy link
Author

Hi @simonhudson
in my case it was related to the translations. I was translating pa11y to Italian, but the it.js inside html_codesniffer node module was not formatted well.

I created it from scratch (starting from the en version), built using the gruntfile.js and now it works fine :)

let me know if it solved the problem.

@simonhudson
Copy link

@riccardolinares Thanks for the prompt response 👍

Looks like mine is an issue with html_codesniffer as well, quite possibly caused by the same malformed file which you saw.

Inspired by this reply to a similar issue, I ran npm install --save-dev axe-core and specified axe as my test runner, rather than the default htmlcs. It doesn't solve the problem with html_codesniffer, but it does seem to provide a work around.

pa11y(url, { runners: ['axe'] })
    .then(results => {
        // Do stuff with results
    })
    .catch(error => {
        // Do stuff with error
    });

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