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.
sahi chrome cookies survive - bug or feature?
Hi,
I already found a solution, but I was wondering nevertheless if this is probably something sahi could improve on or if it's just the way things are.
In chrome under advanced settings - content settings - I set "Keep local data only until I quit my browser".
Then, in chrome not running through sahi, I visit my application under test. I verified it sets it's cookies and when I quit the browser session and then restart chrome and look for the cookies again, they are gone.
Then I run a testcase with sahi on chrome with the same settings and on the same application and let sahi quit chrome. When I then open chrome manually and check for cookies, they are still there.
The problem is, that I get wrong test results with old cookies surviving from one to the next testcase. It's also sahi's own cookie, which is set to end it's lifetime on browser quit, which survives this procedure.
My best guess is that the way sahi closes the browser prevents chrome to clean up.
Now I start chrome with --incognito and my testresults are ok.
This is with sahi bundled in Twist 2.5 and chrome Version 26.0.1410.64 m
If this is the way it's meant to be it probably helps others who struggle with the same behaviour and failing tests to read about this here ...
Thanks!
I already found a solution, but I was wondering nevertheless if this is probably something sahi could improve on or if it's just the way things are.
In chrome under advanced settings - content settings - I set "Keep local data only until I quit my browser".
Then, in chrome not running through sahi, I visit my application under test. I verified it sets it's cookies and when I quit the browser session and then restart chrome and look for the cookies again, they are gone.
Then I run a testcase with sahi on chrome with the same settings and on the same application and let sahi quit chrome. When I then open chrome manually and check for cookies, they are still there.
The problem is, that I get wrong test results with old cookies surviving from one to the next testcase. It's also sahi's own cookie, which is set to end it's lifetime on browser quit, which survives this procedure.
My best guess is that the way sahi closes the browser prevents chrome to clean up.
Now I start chrome with --incognito and my testresults are ok.
This is with sahi bundled in Twist 2.5 and chrome Version 26.0.1410.64 m
If this is the way it's meant to be it probably helps others who struggle with the same behaviour and failing tests to read about this here ...
Thanks!
Answers
Yes,
In order to not retain cookies and for private browsing each time you open chrome through browser, you can add --incognito in chrome options in browser_types.xml.
Regards.
I've been struggling with the same issue and your post really inspired me!However, I am using FireFox, do you know the solution for FF?
Thanks!
I wonder if adding --incognito in options in browser_types.xml also works for FireFox? Which version? And could you please provide some samples? like "<options>-profile "$userDir/browser/ff/profiles/sahi$threadNo" -no-remote-incognito</options>" ?
Thanks!
For firefox, please try the following steps:
1) Open sahi_pro/config/ff_profile_template/pref.js
2) Add the following line in the end of the file: 3) Save the file and restart Sahi.
This should now work for you.
Regards,
Pratyush