Open
Description
System info
- Playwright Version: v1.36
- Operating System: All
- Browser: All
- Other info:
A popup window that includes a button which closes the window sometimes causes an Exception in playwright.
It happens about half the time (probably a race condition that depends on how fast the browser window is closed).
Source code
var popup = await page.RunAndWaitForPopupAsync(async () => {
await buttonThatOpensPopupWindow.ClickAsync();
});
await popup.WaitForLoadStateAsync();
await popup.ClickAsync("#btnOk");
Expected
no exception
Actual
============================================================
Exception: PlaywrightException: Target closed
=========================== logs ===========================
waiting for Locator("#btnOk")
locator resolved to <a class="button-primary" onclick="Foo…>…</a>
attempting click action
waiting for element to be visible, enabled and stable
element is visible, enabled and stable
scrolling into view if needed
done scrolling
performing click action
============================================================
at Microsoft.Playwright.Transport.Connection.InnerSendMessageToServerAsync[T](String guid, String method, Dictionary`2 dictionary, Boolean keepNulls) in /_/src/Playwright/Transport/Connection.cs:line 192
at Microsoft.Playwright.Transport.Connection.WrapApiCallAsync[T](Func`1 action, Boolean isInternal)
at Test.Do(IPage page) in c:\source\Test.cs:line 163