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

Aria queries combined with waitFor* throws unexpected error after page navigation #6766

Closed
kevin940726 opened this issue Jan 21, 2021 · 5 comments · Fixed by #6775
Closed
Assignees

Comments

@kevin940726
Copy link

Steps to reproduce

Tell us about your environment:

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.

@kevin940726 kevin940726 changed the title Aria queries combined with waitFor* throws unexpected error Aria queries combined with waitFor* throws unexpected error after page navigation Jan 21, 2021
@mathiasbynens
Copy link
Member

Jan, could you PTAL? I wonder if this could be a problem for recordings.

@jschfflr
Copy link
Contributor

I can confirm the problem and will investigate!

@jschfflr
Copy link
Contributor

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:

  • Use the undocumented parameter executionContextName for Runtime.addBinding and set it to UTILITY_WORLD_NAME
  • Fix the v8 implementation to either not add the name to the m_activeBindings Set if an executionContextId is 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!

@sunmasters
Copy link

Adding waitForTimeout after reload may work.

@silicakes
Copy link

silicakes commented Jul 5, 2022

It seems this reproduces in the following repo:
https://github.com/electricmonk/ts-react-tdd/runs/7185943119?check_suite_focus=true#step:12:63

It behaves the same locally and remotely and is flaky:

image

When headless is set to false we actually see the items, yet the selector still fails.

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

Successfully merging a pull request may close this issue.

5 participants