-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Description
Bug description
Steps to reproduce the problem:
- Clone https://github.com/romaricpascal/puppeteer-accessibility-snapshot-aria-expanded
- Run
npm install - 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)