Skip to content

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

fix(chromium): handle empty url for initial empty page (#41464)

Pavel Feldman3ec4a4d0d55a
diff --git a/packages/playwright-core/src/server/chromium/crPage.ts b/packages/playwright-core/src/server/chromium/crPage.ts
index 40e6f98171..5c37d8eb8e 100644
--- a/packages/playwright-core/src/server/chromium/crPage.ts
+++ b/packages/playwright-core/src/server/chromium/crPage.ts
@@ -488,7 +488,8 @@ class FrameSession {
});
}
- const isInitialEmptyPage = this._isMainFrame() && this._page.mainFrame().url() === ':';
+ // In r1651606 Chromium changed the URL it reports for the initial empty document from the ":" to "".
+ const isInitialEmptyPage = this._isMainFrame() && (this._page.mainFrame().url() === ':' || this._page.mainFrame().url() === '');
if (isInitialEmptyPage) {
// Ignore lifecycle events, worlds and bindings for the initial empty page. It is never the final page
// hence we are going to get more lifecycle updates after the actual navigation has