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.
_writeToFile with data from the html page
Hello, I would like to write some data as a result of testing from generated html into the file. Whenever I use a variable with _writeToFile function it fails. What am I doing wrong? Are there any other methods to do the same job? Thanks.
function writeToFile($message, $myPath){
var out = new java.io.FileWriter($myPath, true);
out.write($message + "\n");
out.close();
}
var $aa="";
$aa= _getText(_cell("/8000/"));
_writeToFile($aa, "C:\\test_esecution.log"); // Fails
_writeToFile("Test", "C:\\test_esecution.log"); // Works
function writeToFile($message, $myPath){
var out = new java.io.FileWriter($myPath, true);
out.write($message + "\n");
out.close();
}
var $aa="";
$aa= _getText(_cell("/8000/"));
_writeToFile($aa, "C:\\test_esecution.log"); // Fails
_writeToFile("Test", "C:\\test_esecution.log"); // Works
This discussion has been closed.
Comments
var $aa = "";
_set($aa, _getText(_cell("/8000/")));
_writeToFile($aa, "C:\\test_esecution.log");
After the login our application opens another window fullscreen without bars etc, and the explorer
fires the security message whenever i'm sure to close a parent window, so it runs in popup.
I don't know how to simulate the same conditions, but with that window opened all the scripts run smoothly, except when i'm trying to get something from html.
_popup("dialogo")._setValue(_textbox("contentSubView:formSearch:personSurnameInput"), "SURNAME");
var $message="";
_set($message, _popup("dialogo")._getText(_textbox("contentSubView:formSearch:personSurnameInput")));
_debugToFile($message, “C:\sahi_debug.log”);
Error in script: setServerVar('\$message', _popup("dialogo")._getText(_textbox("contentSubView:formSearch:personSurnameInput")));
Window not found: popupNameFromStep=; derivedName=dialogo; windowName=dialogo; windowTitle=Ricerca Contatto; wasOpened=1;
_popup("dialogo")._set($message, _getText(_textbox("contentSubView:formSearch:personSurnameInput")));