From fe433197e86d4c9c77d4681d93f628bd907036be Mon Sep 17 00:00:00 2001 From: kobenguyent Date: Mon, 8 Jan 2024 07:32:58 +0100 Subject: [PATCH] fix: session doesnt respect the context options --- lib/helper/Playwright.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/helper/Playwright.js b/lib/helper/Playwright.js index 390c1b172..d93bd142f 100644 --- a/lib/helper/Playwright.js +++ b/lib/helper/Playwright.js @@ -517,8 +517,9 @@ class Playwright extends Helper { if (this.options.userAgent) contextOptions.userAgent = this.options.userAgent; if (this.options.locale) contextOptions.locale = this.options.locale; if (this.options.colorScheme) contextOptions.colorScheme = this.options.colorScheme; + this.contextOptions = contextOptions; if (!this.browserContext || !restartsSession()) { - this.browserContext = await this.browser.newContext(contextOptions); // Adding the HTTPSError ignore in the context so that we can ignore those errors + this.browserContext = await this.browser.newContext(this.contextOptions); // Adding the HTTPSError ignore in the context so that we can ignore those errors } } @@ -606,7 +607,7 @@ class Playwright extends Helper { page = await browser.firstWindow(); } else { try { - browserContext = await this.browser.newContext(Object.assign(this.options, config)); + browserContext = await this.browser.newContext(Object.assign(this.contextOptions, config)); page = await browserContext.newPage(); } catch (e) { if (this.playwrightOptions.userDataDir) {