Cookies are those small files on your computer that store information between sessions or between two login attempts. There are valid reasons where you might need to delete cookies stored on your computer through scripting.

How can we delete cookies through VB ScriptingDelete cookies in QTP?

Delete Cookies from IE Browser Using VB Script

Method #1: Using WebUtilΒ object.
UseΒ WebUtil.DeleteCookies whenever you want to delete cookies from IE.

Method #2: Using the newly introduced methods you can choose to delete browser cache, cookies or even delete cookies from a specific site instead of deleting all cookies stored in the browser.

To clear Cache from the browser

Browser("Page Title").ClearCache

To delete Cookies from the browser

Browser("Google.com:").DeleteCookies "Google"

The above code will delete cookies for ALL Google domains like google.net, google.com, google.in. Β If you wish to remove cookies for a specific domain use the corresponding Top Level Domain

Browser("Google.com:").DeleteCookies "Google.in"

Delete Cookies from Chrome Browser Using VB Script

Methods listed above are not applicable for Google Chrome browser. To delete cookies from Chrome browser you can take help of SendKeys method.
In Google chrome browser, you can use keyboard shortcut Ctrl + Shift + Delete to invoke Clear browsing data dialog box.

 Browser("Google").highlight 'Make sure browser is in the foreground
Set oDelCookies = CreateObject("WScript.Shell")
oDelCookies.SendKeys "^+{DELETE}" '^ for Ctrl key, + for Shift key
wait 2 'Give time to sync
oDelCookies.SendKeys "{TAB 9}" 'You need to tab 9 times to reach ClearBrowsingData button
wait 1
oDelCookies.SendKeys "{ENTER}"
Set oDelCookies = Nothing

There are other interesting methods posted in the comments section below, don’t forget to check those.