Aria queries combined with waitFor* throws unexpected error after page navigation
See original GitHub issueSteps to reproduce
Tell us about your environment:
- Puppeteer version: v5.5.0
- Platform / OS version: macOS v10.15.7
- URLs (if applicable): https://github.com/kevin940726/puppeteer-aria-query-bug
- Node.js version: 14.15.1
What steps will reproduce the problem?
Aria queries companied with waitFor will fail to query any elements after page navigation.
await page.waitForSelector('aria/Button[role="button"]'); // This is fine
await page.reload(); // Or any other page navigation
await page.waitForSelector('aria/Button[role="button"]'); // Cannot find the element anymore 💀
I’ve put together a minimal repro repo to better demo the issue.
What is the expected result?
It should still successfully get the elements even after page navigation.
What happens instead? It throws timeout error.
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
java - Expected condition failed: waiting for visibility of element ...
This usually happens when you have a loadng overlay placed while page is loading. In such cases selenium cannot find elements after loading ......
Read more >How To Deal With "Element is not clickable at point” Exception ...
In this blog, we will deal with the "Element is not clickable at point” exception using Selenium.
Read more >Common mistakes with React Testing Library - Kent C. Dodds
As time has gone on, we've made some small changes to the API and ... does not throw an error if no element...
Read more >WebDriver - W3C
When asked to wait for navigation to complete , run the following ... If this throws an exception, return error with error code...
Read more >All other Tokyo fixes - Product Documentation | ServiceNow
The following error is thrown: 'Invalid query detected, stack trace below [Unknown field element in table sys_hub_action_type_base]'.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

I can confirm the problem and will investigate!
Ok, so it looks like this boils down to the following problem: v8 checks if a binding has already been installed before. With the current implementation this check returns true even after the reload but the binding will not be there anymore. It seems like there are two possible solutions in this case:
executionContextNameforRuntime.addBindingand set it toUTILITY_WORLD_NAMEm_activeBindingsSet if anexecutionContextIdis set or to remove the name from the set when the execution context is deleted.@mathiasbynens Let me know what you think would be the best option here!