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.waitForSelector() and waitFor: 'attached' not working properly #2026

Closed
thernstig opened this issue Apr 29, 2020 · 1 comment · Fixed by #2047
Closed

[BUG] page.waitForSelector() and waitFor: 'attached' not working properly #2026

thernstig opened this issue Apr 29, 2020 · 1 comment · Fixed by #2047

Comments

@thernstig
Copy link
Contributor

thernstig commented Apr 29, 2020

Context:

  • Playwright Version: 0.15.0
  • Operating System: Ubuntu 18.04.4
  • Node version: v12.15.0
  • Browser: Chromium

Code Snippet

// always works
await page.waitForSelector('lib-table-widget v0-icon', {
  waitFor: 'visible',
});
// never works
await page.waitForSelector('lib-table-widget v0-icon');

Here is the JSPath to the selector:

document.querySelector("body > container").shadowRoot.querySelector("#container > container-layout-holder").shadowRoot.querySelector("#LayoutHolder-app-content > app-content").shadowRoot.querySelector("#AppContent-inner > alarm-viewer").shadowRoot.querySelector("div > lib-dashboard").shadowRoot.querySelector("div > lib-tablwidget > div:nth-child(2) > lib-table").shadowRoot.querySelector("div:nth-child(3) > internal-extended-table").shadowRoot.querySelector("div > table > tbody > tr > td:nth-child(2) > span > span > v0-icon")

Describe the bug

I have no idea, but lately I've been noticing a lot of flakiness with waitForSelector() with its default for waitFor. As in the above case, as the default is waitFor: 'attached', attached surely needs to happen for visible to occur. Still the default does not work. It times out waiting for the element.

@thernstig thernstig changed the title [BUG] page.waitForSelector() not working consistently [BUG] page.waitForSelector() and waitFor: 'attached' not working properly Apr 29, 2020
@dgozman
Copy link
Contributor

dgozman commented Apr 30, 2020

Looking at the code, there is a difference: attached defaults to "poll on mutations", while visible defaults to "poll on rafs". I'll look into fixing this.

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.

2 participants