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] Firefox Timeout while waiting for popup #3971

Closed
mwallace72 opened this issue Sep 24, 2020 · 10 comments
Closed

[BUG] Firefox Timeout while waiting for popup #3971

mwallace72 opened this issue Sep 24, 2020 · 10 comments

Comments

@mwallace72
Copy link

mwallace72 commented Sep 24, 2020

Context:

  • Playwright Version: 0.11.1
  • Operating System: Mac 10.13.6
  • Node.js version: 12.14.1
  • Browser: Firefox
  • Extra: We are using 0.11.1 Playwright for compatibility with Mac Sierra, as I understand newer Playwright versions do not accept Mac Sierra

Code Snippet

Help us help you! Put down a short code snippet that illustrates your bug and
that we can run and debug locally. For example:

it.each(['chromium', 'firefox'])(`${testTitle} [%s]`, async browserType => {
    const playwright = new PlaywrightUtilStructure(browserType)
    await playwright.launchBrowser() // creates browser & context instances
    await playwright.launchApp() // goes to page
    try {
      const landingPage = new LandingPage(playwright.page) // util functions, not critical
      // .. other validation
      const [popup] = await Promise.all([
        playwright.page.waitForEvent('popup'),
        await landingPage.clickLoginItem(), // Click triggers a popup.
      ])
      // The promise resolves after 'domcontentloaded' event.
      await popup.waitForLoadState('domcontentloaded')
      console.log(await popup.title()) // Popup is ready to use.
    } catch (err) {
      await playwright.screenshotCloseBrowserThrow(testTitle, err)
    }
    // Close after finished test success
    await playwright.closeBrowser()
  })

Describe the bug

We have this code running for chromium & firefox (see above via it.each) and chromium passes fine.
The log line prints the expected name of the popup, and when running in headless=false mode we can see the popup open and can confirm it matches the log.
On firefox however, the code hangs during the Promise.all phase with the following:

TimeoutError: Timeout exceeded while waiting for popup

      18 |       const [popup] = await Promise.all([
    > 19 |         playwright.page.waitForEvent('popup'),
         |                         ^
      20 |         await landingPage.clickLoginItem(), // Click triggers a popup.
      21 |       ])
      22 |       // The promise resolves after 'domcontentloaded' event.

But I can confirm the popup is appearing (and not even slowly).

I recognize this might be a "get on the proper version of Playwright" kind of issue, considering we're not using even the 1.0.0 version, but was hoping someone might have input.

@aslushnikov
Copy link
Collaborator

@mwallace72 from the first sign, it looks like you have an extra await inside your Promise.all statement:

// .. other validation
const [popup] = await Promise.all([
  playwright.page.waitForEvent('popup'),
  /* await */ landingPage.clickLoginItem(), // <<== `await` is not needed here
])

@mwallace72
Copy link
Author

@aslushnikov That is accurate, but on removal nothing changes. Thanks for spotting it though.

@mwallace72
Copy link
Author

Attempting some version changes of Playwright as well, to see if any don't experience the problem:

  • 0.12.0 -> Failed post-install with UnhandledPromiseRejectionWarning: TypeError: downloadOptionsFromEnv is not a function
  • 0.12.1 -> import playwright fails TypeError: path.join is not iterable (cannot read property Symbol(Symbol.iterator))
  • 0.13.0 -> import playwright fails Unsupported platform for webkit: mac10.13
  • 0.14.0 -> import playwright fails Unsupported platform for webkit: mac10.13
  • 0.15.0 -> import playwright fails Unsupported platform for webkit: mac10.13
  • 0.16.0 -> Chromium now fails with TimeoutError: Timeout exceeded while waiting for popup (even though popup is indeed open)
  • 0.17.0 -> Failed post-install UnhandledPromiseRejectionWarning: Error: ERROR: Playwright does not support webkit on mac10.13
  • 0.18.0 -> Failed post-install UnhandledPromiseRejectionWarning: Error: ERROR: Playwright does not support webkit on mac10.13
  • 1.0.2 -> Chromium now fails with TimeoutError: Timeout exceeded while waiting for popup (even though popup is indeed open)
  • 1.1.0 -> Failed post-install UnhandledPromiseRejectionWarning: Error: ERROR: Playwright does not support webkit on mac10.13
  • 1.1.1 -> Chromium click function to open popup fails TimeoutError: Timeout 30000ms exceeded during elementHandle.click (even though popup is indeed open)
  • 1.2.0 -> Failed post-install UnhandledPromiseRejectionWarning: Error: ERROR: Playwright does not support webkit on mac10.13
  • 1.2.1 -> Chromium click function to open popup fails TimeoutError: Timeout 30000ms exceeded during elementHandle.click (even though popup is indeed open)
  • 1.3.0 -> Chromium click function to open popup fails TimeoutError: Timeout 30000ms exceeded during elementHandle.click (even though popup is indeed open)
  • 1.4.0 -> Failed post-install UnhandledPromiseRejectionWarning: Error: ERROR: Playwright does not support webkit on mac10.13
  • 1.4.1 -> Failed post-install UnhandledPromiseRejectionWarning: Error: ERROR: Playwright does not support webkit on mac10.13

@arjunattam
Copy link
Contributor

Thanks for checking! Playwright does not support webkit on mac10.13 was fixed in #3943 and we will be releasing 1.4.2 with the fix today. In the mean time, you can use playwright@next to use latest master. Apologies for the trouble!

@mwallace72
Copy link
Author

mwallace72 commented Sep 24, 2020

@arjun27 thanks for letting me know - did an install (playwright@1.4.0-next.1600969657354) on running my test, saw the same behavior as 1.30 and others:

Chromium click function to open popup fails TimeoutError: Timeout 30000ms exceeded during elementHandle.click (even though popup is indeed open)
So now I can't even get through on Chromium - it fails on my await landingPage.clickLoginItem(), // Click triggers a popup. line. Firefox also fails, with the same.
Expanded error:

TimeoutError: elementHandle.click: Timeout 30000ms exceeded.
    =========================== logs ===========================
    attempting click action
      waiting for element to be visible, enabled and not moving
        element is not visible - waiting...
    ============================================================
    Note: use DEBUG=pw:api environment variable and rerun to capture Playwright logs.elementHandle.click: Timeout 30000ms exceeded.
    =========================== logs ===========================
    attempting click action
      waiting for element to be visible, enabled and not moving
        element is not visible - waiting...
    ============================================================
    Note: use DEBUG=pw:api environment variable and rerun to capture Playwright logs.:

Thanks for the support, and the great tool - I've really enjoyed it, aside from my team introducing this popup :D

@mwallace72
Copy link
Author

I've also tried

const [page] = await Promise.all([
        playwright.context.waitForEvent('page'),
        landingPage.clickLoginItem(),
      ])

while using playwright@1.0.2 (since before that failed waiting for event popup) but that failed waiting for page, too on Chromium.

@aslushnikov
Copy link
Collaborator

For the record: Playwright 1.4.2 is out with a fix for MacOS 10.13 - https://github.com/microsoft/playwright/releases/tag/v1.4.2

@mwallace72 from the extended logs that you published it looks like clicking fails because element is invisible. Could it be the case? Can you try running in non-headless mode to make sure that the button is actually clickable?

If the button is clickable - any chance you can help us to reproduce this behavior locally so that we can debug it?

@mwallace72
Copy link
Author

mwallace72 commented Sep 25, 2020

@aslushnikov I'll try and repro some code for it that's non-specific.
It is running headless, and I can confirm the popup is there.
In the times where the click has failed, it's claiming to fail on clicking the element that spawns the popup even though the click succeeds and the popup opens. I can confirm the popup is not opening early, because if I comment out the code, no popup opens (as expected).
It's like a race condition with the element to click - in that it's clicking before confirming the click has occurred, and then once the popup opens, likely the click element isn't interact-able.

@ixmeza
Copy link

ixmeza commented Sep 25, 2020

I have similar issue, only difference is that I click on button and this opens a new window, which I later want to interact with and I can't...

@mwallace72
Copy link
Author

I'm delighted to announce that even though my use of playwright@next earlier did not succeed, my use of the official playwright@1.4.2 did succeed, on both Chromium & Firefox (right in the middle of my trying to make a repro which also succeeded for both)

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

No branches or pull requests

4 participants