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.
_deleteFile() API doesn't work
Hi Guys,
I was intended to delete a file from a specified path, but when I tried API _deleteFile(), it turned out not working for me, error message I got was:
"[Exception] TypeError: _sahi._deleteFile is not a function"
Do you guys know why this API is not working?
Thanks,
Min
I was intended to delete a file from a specified path, but when I tried API _deleteFile(), it turned out not working for me, error message I got was:
"[Exception] TypeError: _sahi._deleteFile is not a function"
Do you guys know why this API is not working?
Thanks,
Min
This discussion has been closed.
Comments
Apart from the previous question, is there any way to delete all the files under a specified path instead of deleting files one by one?
Many thanks,
Min
If you want to delete a particular File then you can use _deleteFile("File Name");
If you want to delete all files under a specified path then you can copy all his files to one folder and call the below java code in the sahi script.
The java code :
http://www.java2s.com/Tutorial/Java/0180__File/Removeadirectoryandallofitscontents.htm
Also refer http://sahi.co.in/w/sahi-scripting-calling-java
Regards
Sumitra
I am testing remember me functionality on a login screen. After successfully tested I need to uncheck the remember me checkbox and delete the text displayed in the username textbox. I have tried the below API, but getting Reference Error: _deleteText is not defined. Can you please tell me which API should i use to delete the text?
_deleteText(_textbox("j_username")):
There is no API called as _deleteText();
Instead you can use
function clearText(el){
_setValue(el,"");
}
clearText(_textbox(0)); This would clear the value displayed in the textbox.
You can also:
function clearText(el){
_setValue(el,"");
}
clearText(_textbox(0)); Save this file as lib.sah and include this in the script using _include() API.
To uncheck the remember me checkbox, you can use:
_uncheck(checkBoxElement);
Let me know if you face any problem.
Regards
Sumitra