diff --git a/packages/playwright-core/src/server/browserContext.ts b/packages/playwright-core/src/server/browserContext.ts index 2a88e641bc..0aa9d59916 100644 --- a/packages/playwright-core/src/server/browserContext.ts +++ b/packages/playwright-core/src/server/browserContext.ts @@ -295,7 +295,8 @@ export abstract class BrowserContext extends SdkObject { async _loadDefaultContext(progress: Progress) { const pages = await this._loadDefaultContextAsIs(progress); - if (this._options.isMobile || this._options.locale) { + const browserName = this._browser.options.name; + if ((this._options.isMobile && browserName === 'chromium') || (this._options.locale && browserName === 'webkit')) { // Workaround for: // - chromium fails to change isMobile for existing page; // - webkit fails to change locale for existing page. diff --git a/tests/library/har.spec.ts b/tests/library/har.spec.ts index 21f1990d12..da05fc0d95 100644 --- a/tests/library/har.spec.ts +++ b/tests/library/har.spec.ts @@ -79,7 +79,7 @@ it('should have pages', async ({ contextFactory, server }, testInfo) => { expect(pageEntry.pageTimings.onLoad).toBeGreaterThan(0); }); -it('should have pages in persistent context', async ({ launchPersistent }, testInfo) => { +it('should have pages in persistent context', async ({ launchPersistent, browserName }, testInfo) => { const harPath = testInfo.outputPath('test.har'); const { context, page } = await launchPersistent({ recordHar: { path: harPath } }); await page.goto('data:text/html,