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.
Why do the files remain blank after i try to use writefile??
Hey
i have been trying all day to write messages to a text file. But the writefile doesnt seem to work at all. the file is always blank when i open it. i tried writing to a csv file but that did not work either.
Am i missing some steps??
1)
_writeToFile("Test passed without errors","C:\Users\hishamn\sahi\userdata\scripts\TestLog.txt");
2)
var $Result= [
["Test", "Passed"],
["without", "errors"] ];
_writeToFile($Result,"C:\Users\hishamn\sahi\userdata\scripts\TestResults.csv", overwrite);
i have been trying all day to write messages to a text file. But the writefile doesnt seem to work at all. the file is always blank when i open it. i tried writing to a csv file but that did not work either.
Am i missing some steps??
1)
_writeToFile("Test passed without errors","C:\Users\hishamn\sahi\userdata\scripts\TestLog.txt");
2)
var $Result= [
["Test", "Passed"],
["without", "errors"] ];
_writeToFile($Result,"C:\Users\hishamn\sahi\userdata\scripts\TestResults.csv", overwrite);
This discussion has been closed.
Comments
The code should be:
Let me know if this solves your issue.
Regards
Sumitra
Your way of declaring the data is correct, and so is Sumitra's. They are just different ways of doing the same thing.
I guess your problem is with the slashes in the file path. Change them to forward slashes, or use double back slashes and check.
C:/Users/hishamn/sahi/userdata/scripts/TestResults.csv
or
C:\\Users\\hishamn\\sahi\\userdata\\scripts\\TestResults.csv
Regards,
Narayan