deleteCookies (formerly deleteAllCookies) - Selenium IDE command

The deleteCookies command deletes all cookies of the current website - the site loaded in the macro's browser tab. It does not touch the cookies of any other website, and it does not clear the cache or local storage.

The command was previously called deleteAllCookies. It was renamed because the old name suggested it deletes every cookie in the browser, which it never did. Existing macros that use the old deleteAllCookies name continue to work - the old spelling is accepted silently, no change needed.

Command: deleteCookies
Target: (empty)
Value: (empty)

When to use it

deleteCookies is the standard "clean up" command at the start of a test or macro:

Reproducible macros: Many websites (travel search, shops, configurators) restore your previous search or form entries from cookies. A macro can then look correct while actually doing nothing - the values were restored by the site, not entered by the macro. Placing deleteCookies at the start of the macro guarantees every run starts from the same clean state.

Testing login flows: Deleting the site's cookies logs you out of that site, so a login macro can be tested repeatedly.

Consent banners: After deleteCookies, the website treats you as a first-time visitor - cookie/consent banners will appear again. Make sure the macro handles the banner (for example with BClickText on the accept button's text, wrapped so it is optional).

Note: Since the command logs you out of the current website and brings back consent banners, use it deliberately - for example, only in test macros, not in macros that rely on an existing login session.

A useful combination is deleteCookies together with selectWindow | tab=closeallother to reset the whole test environment.

What it does not delete

- Cookies of other websites (only the current site's cookies are removed)
- Cache, browsing history, local storage and session storage

If you need a more thorough reset, two alternatives:

1. Run the macro in the browser's incognito/private mode - this also isolates cache and storage. Just remember to check the "Allow in incognito" box for your Ui.Vision RPA addon on the Chrome extension page.

2. Simulate the "Clear Browsing Data" keyboard shortcut (with XType, RealUser Simulation XModule required) to delete cookies, browsing history and cache in one step - see this forum post for details.

deleteCookies Example

Command Target Pattern/Text
deleteCookies
open https://ui.vision/

A good page for testing cookie behavior is http://www.html-kit.com/tools/cookietester/.

Works in

Ui.Vision RPA for Chrome and Edge Selenium IDE, Ui.Vision RPA for Firefox Selenium IDE, Firefox IDE Classic (there historically called deleteallvisiblecookies).

Related Demo Macros

Demo-Autofill, Demo-Frame

The ready-to-import-and-run source code of all demo macros can be found in the Open-Source RPA software Github repository.

See also

selectWindow, executeScript_Sandbox, Web Automation Extension User Manual, Selenium IDE commands, Classic Firefox Selenium IDE.

Anything wrong or missing on this page? Suggestions?

...then please contact us.

<em>Ui.Vision RPA</em> Selenium IDE for Chrome and Firefox - Web Test Automation

Fresh from the Ui.Vision Forum: The Latest 3 Topics.

← Meet the Ui.Vision team and users in our forums.