Storage

Delete Storage

Clears or selectively deletes browser storage based on the requested storage type (cookies, localStorage, sessionStorage, cache or indexedDb). If no storage type is provided, globally clears all browser storage. Otherwise provides targeted removal using domain, key, path, or storeName.

NOTE

Deleting a specific 'storageType' without specifying any other parameters will delete all storage of that type.

Parameter Cookies LocalStorage SessionStorage Cache Storage IndexedDB
Domain action.Domain (implicit current origin) (implicit current origin) (implicit current origin) (unused, origin-scoped)
Path action.Path (cookie path) (unused) (unused) (unused) action.Path (database name)
StoreName (unused) (unused) (unused) action.StoreName (cache name) action.StoreName (object store)
Key action.Key (cookie name) action.Key action.Key action.Key (cache name / request) action.Key (record key)
Wildcard allowed? Domain, Path, Key Key only Key only StoreName, Key Path, StoreName, Key

Examples

GPAL Fluent: High-level fluent C# API

//RunDelete with no filter removes everything the url declared for that type, which is the usual way to clear a site down before a run. WithUserDefined puts a tag of your own on a declared action and WithUserDefinedFilter picks it back up, which beats repeating a long key in every call. As with the other two, nothing outside what the url declared is ever touched.

GPALUrl youtube = "www.youtube.com";


youtube.WithStorageType(WebsiteStorageType.cookie)

.WithStorageDomain("youtube.com")

.WithStoragePath("/");


// tagged, so one call can name it later without repeating the key

youtube.WithStorageType(WebsiteStorageType.localStorage).WithUserDefined("dm");


browser.GoTo(youtube);


// every cookie action declared on the url

browser.RunDelete(WebsiteStorageType.cookie);


// or only the one that was tagged

browser.WithUserDefinedFilter("dm")

.RunDelete(WebsiteStorageType.localStorage);

MagicHelper: MagicHelper utility library

browser.MagicHelper.DeleteStorage(WebsiteStorageType storage type, bool deleteAcrossOrigins, string domain, string path, string key, string storeName);

Puppeteer Client: Puppeteer-style C# client

browser.PuppeteerClient.DeleteStorage(WebsiteStorageType.cookie).WithStorageDomain("ebay.com").WithStorageKey("utag_main_ses_id").Execute();

browser.PuppeteerClient.DeleteStorage(WebsiteStorageType.cookie).WithDeleteAcrossOrigins(true).Execute();

Puppeteer Communicator: Low-level communicator

await browser.PuppeteerCommunicator.DeleteStorage(string storageType, string sessionId, string domain, string storeName, string path, string key);

REST Client: Direct REST/HTTP client

browser.OttoMagicClient.WithEndpoint(ApiEndpoint.DeleteStorage).Execute();

browser.OttoMagicClient.WithEndpoint(ApiEndpoint.DeleteStorage).WithStorageType(WebsiteStorageType.cookie).WithStorageDomain("ebay.com").WithStorageKey("utag_main_ses_id").Execute();

browser.OttoMagicClient.WithEndpoint(ApiEndpoint.DeleteStorage).WithStorageType(WebsiteStorageType.cookie).WithStorageDomain("youtube.com").Execute();

browser.OttoMagicClient.WithEndpoint(ApiEndpoint.DeleteStorage).WithStorageType(WebsiteStorageType.cookie).Execute();

💬 Ask GPAL