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

Implement fix without retries when working with locator.waitFor which can error during a page navigation #1501

Open
ankur22 opened this issue Oct 29, 2024 · 0 comments
Labels
bug Something isn't working internal internal improvements and features maintenance performance

Comments

@ankur22
Copy link
Collaborator

ankur22 commented Oct 29, 2024

What

When working with locator.waitFor, it will error causing the iteration to end early if a navigation occurs while the waitFor is waiting. This happens when we perform something like:

await page.goto('some-url') // Pointing to a URL which perform multiple redirects such as login via SSO

await page.locator('some-selector').waitFor() // This can fail if the navigation is still redirecting/not completed

Multiple errors can occur:

  • "Inspected target navigated or closed"
  • "Cannot find context with specified id"
  • "Execution context was destroyed"

We have implemented a workaround which can be found in #1469, which will detect the errors listed above and retry again, with the hopes that eventually the navigation will complete and the element is found that matches the selector.

Why

Although we have a workaround, it doesn't feel like the correct one and it is limited by a retry count of 20. We need to work out a longer term solution without relying on a retry. Looking at Playwright and Puppeteer might help work out how to best work with waitFor when navigating.

related: #1472, https://github.com/grafana/xk6-browser/pull/1469/files

@ankur22 ankur22 added bug Something isn't working maintenance performance internal internal improvements and features labels Oct 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working internal internal improvements and features maintenance performance
Projects
None yet
Development

No branches or pull requests

1 participant