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

[Bug]: page.accessibility.snapshot throws after updating an element with aria-expanded #9404

Closed
romaricpascal opened this issue Dec 12, 2022 · 1 comment · Fixed by #9395
Closed

Comments

@romaricpascal
Copy link

romaricpascal commented Dec 12, 2022

Bug description

Steps to reproduce the problem:

  1. Clone https://github.com/romaricpascal/puppeteer-accessibility-snapshot-aria-expanded
  2. Run npm install
  3. Run node index.js

The script runs Puppeteer to manipulate the page in index.html, clicking the button to swap its aria-expanded attribute and updating its label. When the scripts queries the accessibility tree snapshot after clicking, the snapshot method throws.

This is a minimal reproduction of an issue we recently had when dependabot upgraded Puppeteer from 19.3.0 to 19.4.0.

You can uncomment line 16 in index.js to show a possible workaround that uses an aria/ selector to wait for the accessibility tree to have been updated. Another option is to use waitForTimeout with the risk of flakiness it may involve depending on the timeout duration. Note that using a CSS selector (eg. [aria-expanded="true"]) instead of the aria/ selector doesn't work around the issue.

Not updating aria-expanded in the event handler on the page (index.html line 30) also prevents the script from throwing.

Puppeteer version

19.4.0

Node.js version

18.12.1

npm version

8.19.2

What operating system are you seeing the problem on?

macOS

Configuration file

No response

Relevant log output

if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
                                                                                             ^

TypeError: Cannot read private member from an object whose class did not declare it
    at __classPrivateFieldGet (/Users/romaric.pascal/code/puppeteer-accessible-name/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Accessibility.js:25:94)
    at AXNode._AXNode_hasFocusableChild (/Users/romaric.pascal/code/puppeteer-accessible-name/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Accessibility.js:417:17)
    at AXNode.isLeafNode (/Users/romaric.pascal/code/puppeteer-accessible-name/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Accessibility.js:230:93)
    at Accessibility.collectInterestingNodes (/Users/romaric.pascal/code/puppeteer-accessible-name/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Accessibility.js:149:18)
    at Accessibility.collectInterestingNodes (/Users/romaric.pascal/code/puppeteer-accessible-name/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Accessibility.js:154:18)
    at Accessibility.collectInterestingNodes (/Users/romaric.pascal/code/puppeteer-accessible-name/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Accessibility.js:154:18)
    at Accessibility.collectInterestingNodes (/Users/romaric.pascal/code/puppeteer-accessible-name/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Accessibility.js:154:18)
    at Accessibility.snapshot (/Users/romaric.pascal/code/puppeteer-accessible-name/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Accessibility.js:125:14)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async getAccessibleName (/Users/romaric.pascal/code/puppeteer-accessible-name/index.js:23:11)
@OrKoN
Copy link
Collaborator

OrKoN commented Dec 12, 2022

Looks like something has changed on the backend and 0(invalid nodeId) can now be returned a child node. I will see if we need to file a bug upstream for that. Gonna put up a PR fixing the exception, thanks a lot of the perfect repro!

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

Successfully merging a pull request may close this issue.

2 participants