Skip to main content

clearSession

Overview

Browser command that clears session state (deletes cookies, clears local and session storages).

Usage

await browser.clearSession();

Usage Examples

it("test", async ({ browser }) => {
await browser.url("https://github.com/gemini-testing/testplane");

(await browser.getCookies()).length; // 5
await browser.execute(() => localStorage.length); // 2
await browser.execute(() => sessionStorage.length); // 1

await browser.clearSession();

(await browser.getCookies()).length; // 0
await browser.execute(() => localStorage.length); // 0
await browser.execute(() => sessionStorage.length); // 0
});