Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

fix(edge): be ready for non-windowed pages (#40071)

Dmitry Gozmanca6ab31b234a
diff --git a/packages/playwright-core/src/server/chromium/crPage.ts b/packages/playwright-core/src/server/chromium/crPage.ts
index 69399efd0a..ab31439954 100644
--- a/packages/playwright-core/src/server/chromium/crPage.ts
+++ b/packages/playwright-core/src/server/chromium/crPage.ts
@@ -441,8 +441,13 @@ class FrameSession {
if (!this._page.isStorageStatePage && hasUIWindow &&
!this._crPage._browserContext._browser.isClank() &&
!this._crPage._browserContext._options.noDefaultViewport) {
- const { windowId } = await this._client.send('Browser.getWindowForTarget');
- this._windowId = windowId;
+ try {
+ const { windowId } = await this._client.send('Browser.getWindowForTarget');
+ this._windowId = windowId;
+ } catch {
+ // Some pages in Edge, like internal UIs, are mis-classified as "page", but do
+ // not actually have a browser window. That's fine, we won't resize them.
+ }
}
if (this._isMainFrame() && hasUIWindow && !this._page.isStorageStatePage)