From 14a9591fc6abc0472455c3c160a868df5e4dff2d Mon Sep 17 00:00:00 2001 From: Vorobeyko Date: Thu, 6 Aug 2020 11:08:16 +0300 Subject: [PATCH] feat(helper): Clear SessinStorage --- lib/helper/Playwright.js | 3 +++ lib/helper/Puppeteer.js | 3 +++ 2 files changed, 6 insertions(+) diff --git a/lib/helper/Playwright.js b/lib/helper/Playwright.js index 82221a9ad..9a63b26f3 100644 --- a/lib/helper/Playwright.js +++ b/lib/helper/Playwright.js @@ -348,6 +348,9 @@ class Playwright extends Helper { await this.executeScript('localStorage.clear();').catch((err) => { if (!(err.message.indexOf("Storage is disabled inside 'data:' URLs.") > -1)) throw err; }); + await this.executeScript('sessionStorage.clear();').catch((err) => { + if (!(err.message.indexOf("Storage is disabled inside 'data:' URLs.") > -1)) throw err; + }); } // await this.closeOtherTabs(); return this.browser; diff --git a/lib/helper/Puppeteer.js b/lib/helper/Puppeteer.js index 1d8ec9bf0..496a05b25 100644 --- a/lib/helper/Puppeteer.js +++ b/lib/helper/Puppeteer.js @@ -295,6 +295,9 @@ class Puppeteer extends Helper { await this.executeScript('localStorage.clear();').catch((err) => { if (!(err.message.indexOf("Storage is disabled inside 'data:' URLs.") > -1)) throw err; }); + await this.executeScript('sessionStorage.clear();').catch((err) => { + if (!(err.message.indexOf("Storage is disabled inside 'data:' URLs.") > -1)) throw err; + }); } await this.closeOtherTabs(); return this.browser;