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.
Issue working with _deleteCookie() API
Hi,
_deleteCookie() is not working.Although it is running successfully but it is not deleting the cookies.
_deleteCookie() is not working.Although it is running successfully but it is not deleting the cookies.
Comments
_deleteCookie() API would work if you are using it from the Controller.
Can you please let me know how are you using it?
Also, Kindly record the script for deleting the cookie and check.
Note: You really cannot delete cookie if its in a different domain.
Regards
Sumitra
yes i am running it from sahi controller.still its not working.I
m trying to clear the cookies from the same browser I am working in.But still its not working.
And in the sahi website the details about this _deleteCookie() is not showing.Can you please tell me how to clear the cookies from the browser you are working, with out closing it.
Regards
Lipika
It seems that the domain from which you are deleting the cookie and the domain from where you navigated to delete the cookie are different.
For Eg:
In the below code:
If you are navigating to http://yahoo.com and next if you are navigating to http://in.yahoo.com/_s_/dyn/Cookies_showall then these 2 are totally in a different domain and you wont be able to delete the Cookie.
Kindly make sure that the domains are not different and check if you are able to delete the cookie.
Regards
Sumitra
Not sahi specific but its a generalize solution.
Just mentioning over here to overcome Domain related limitation and also if you are not using sahi controller for execution this will be helpful.
You can call following batch file from sahi to remove cookies of your firefox browser.
////// Batch file
@echo off
set DataDir=C:\Users\%USERNAME%\AppData\Local\Mozilla\Firefox\Profiles
del /q /s /f "%DataDir%"
rd /s /q "%DataDir%"
for /d %%x in (C:\Users\%USERNAME%\AppData\Roaming\Mozilla\Firefox\Profiles\*) do del /q /s /f %%x\*sqlite
//////