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.
To clear cache , cookies and history in mozilla firefox
Hi
Can anyone help me to clear cache , cookies and history in browser(mozilla firefox)through .bat file when the bat file is called using sahi script in a test.
Can anyone help me to clear cache , cookies and history in browser(mozilla firefox)through .bat file when the bat file is called using sahi script in a test.
Comments
Please find the below batch code to clear history & cache from 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
//////
You can call this batch file from SAHI.
Let me know if that doesn't help you.
-Ashish
Thanks for your reply , we are already using the same script through a .bat file , The problem is when we are running this bat file the cookies, history and cache is getting cleaned however , we are unable to login to the application (web application) even after reloading the page. The requirement is we need to clear the cache while the browser is open so that the previous data would not interrupt while running a script.
We are able to login to the application when we are clearing manually from tools-->options-->clear your recent history-->select cookies and cache --> click on ok button. eagerly waiting for your reply .
regards
Rajendra
You can try to open a private browser,so that it contains no history,cache and cookies.To do so,
append -private to the options tag in browsertypes.xml file.A new private browser will be launced each time.To do the same with chrome append --incognito and with opera append -newwindow.
This might help you.
Regards,
Theeran.
@echo off
:MENU
echo choose the following operations
echo 1:notepad
echo 2:ccleaner
echo 3:firefox
echo 4:notepad++
echo 5:cmd
Set option=
set /p option=Your option:
if %option%==1 start notepad.exe
if %option%==2 start ccleaner.exe
if %option%==3 start 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
if%option%==3 start firefox www.fb.com www.gmail.com
if %option%==4 start notepad++.exe
if %option%==5 start cmd.exe