From 55702e968935cd68578fb73d59a5e90b00ce99d3 Mon Sep 17 00:00:00 2001 From: rahulxyz Date: Thu, 26 Nov 2020 14:39:10 +0530 Subject: [PATCH] Allow access to localStorage --- runtime/helpers.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/runtime/helpers.js b/runtime/helpers.js index dd83cae..127ef94 100755 --- a/runtime/helpers.js +++ b/runtime/helpers.js @@ -335,6 +335,18 @@ module.exports = { return driver.executeScript(getAfterContentValue, cssSelector); }, + /** + * Get local storage + * @returns {Promise} executes .then with value + * @example + * helpers.getLocalStorage().then(function(localStorage) { + * console.log(localStorage['token']); + * }); + */ + getLocalStorage: function() { + return driver.executeScript(`return window.localStorage`); + }, + clearCookies: function() { return driver.manage().deleteAllCookies(); },