18 January 2026:
Sahi Pro is an enterprise grade test automation platform which can automate web, mobile, API, windows and java based applications and SAP.
This forum is now archived and is in read-only mode. Please continue discussions on our improved new Sahi Pro Community forum.
Sahi Pro is an enterprise grade test automation platform which can automate web, mobile, API, windows and java based applications and SAP.
How to use the API _deleteCookie(name) ?
Hi Team,
How can I delete cookie use the _deleteCookie(name)?
e.g.
I open the yahoo mail
and try to delete cookie use "_deleteCookie("sahisid");"
but the cookie never deleted.
How can I delete cookie use the _deleteCookie(name)?
e.g.
I open the yahoo mail
and try to delete cookie use "_deleteCookie("sahisid");"
but the cookie never deleted.
Comments
You just need to mention the name of the cookie.
_deleteCookie("Name of the Cookie");
Here is the explanation:
Launch FF >> Navigate to yahoo.com >> If you navigate to https://yahoo.com/_s_/dyn/Cookies_showAll you will be able to view all the cookies >> Now go back to yahoo.com page >> On controller perform _deleteCookie("HP") >> Now if you navigate back to https://yahoo.com/_s_/dyn/Cookies_showAll you could see that the cookie by name HP would be deleted.
Let me know if you face any problem.
Regards
Sumitra
Hi Sumitra,
Thank you for your response, Following your way, I can see there are 7 cookies for yahoo mail, and I run the delete cookie case successfully ,see results below, but the cookies still not deleted, my yahoo mail still stay in login status, but if I delete these cookies manually, the login status disappear.
Seems the _deleteCookie() function not work, what do you think?
_deleteCookie("F");
_deleteCookie("YLS");
_deleteCookie("Y");
_deleteCookie("PH");
_deleteCookie("T");
_deleteCookie("SSL");
--Stopped Playback: SUCCESS--
The above steps would work fine only from Controller. If you want to delete a cookie with script then youcan write a script which would look like this:
_navigateTo("http://yahoo.com/"
_navigateTo("http://yahoo.com/_s_/dyn/Cookies_showAll"
_check(_checkbox("1"));
_click(_button("Delete"));
_navigateTo("http://yahoo.com/_s_/dyn/Cookies_showAll"
Note: You really cannot delete cookie if its in a different domain.
Let me know if this solves your issue.
Regards
Sumitra