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.
Script failing with JSERROR - object is a reserved keyword
When executing the given below script, Sahi fails at line "function k_s($fname) {" with the above JSERROR.
_debugToFile("test32.sah" ,"c:\\log.txt");
function writeToFile($case_id) {
var out = new java.io.FileWriter("scp_test.txt");
out.write("waitforwindow,File Download\n");
out.write("PressButton,File Download,&Save\n");
out.write("waitforwindow,Save As\n");
out.write("keypress,D:\\output\\" + $case_id + ".xls\n");
out.write("PressButton,Save As,&Save\n");
out.close();
}
function k_s($fname) {
boolean exists = false;
boolean flag = true;
while (flag) {
exists = (new java.io.File($fname)).exists();
if (exists) {
_debugToFile("Found:" + $fname ,"c:\\log.txt");
flag = false;
}
}
}
function login($usr, $pwd) {
_setValue(_textbox("uid"),$usr);
_setValue(_password("pwd"), $pwd);
_click(_submit("Submit1"));
try {
if (_condition(_cell(_table(0), 1, 1).innerText == "The user is already logged into the system through another browser session. Do you wish to take over the session? ")) {
_click(_button("OK"));
}
} catch (e) {
}
_wait(1000);
}
login("ptuser5","manager");
_click(_link("Create Query"));
_click(_link("Advanced Conditions"));
_click(_link("Library[2]"));
_setValue(_textbox("txtSearchName"), "PT_AC1_WAC_17_04_09_0032");
_click(_submit("Search"));
_click(_cell(_table("oAdvConditions"), 0, 0));
_click(_submit("btnExecute"));
writeToFile("PT_AC1_WAC_17_04_09_0032");
_click(_submit("btnExport"));
_execute("scriptO.exe",false);
k_s("d:\\output\\" + "PT_AC1_WAC_17_04_09_0032" + ".xls");
_debugToFile("[PASSED]" ,"c:\\log.txt");
Any guess to what may be the problem is.
Thanks in advance.
- Sounav
_debugToFile("test32.sah" ,"c:\\log.txt");
function writeToFile($case_id) {
var out = new java.io.FileWriter("scp_test.txt");
out.write("waitforwindow,File Download\n");
out.write("PressButton,File Download,&Save\n");
out.write("waitforwindow,Save As\n");
out.write("keypress,D:\\output\\" + $case_id + ".xls\n");
out.write("PressButton,Save As,&Save\n");
out.close();
}
function k_s($fname) {
boolean exists = false;
boolean flag = true;
while (flag) {
exists = (new java.io.File($fname)).exists();
if (exists) {
_debugToFile("Found:" + $fname ,"c:\\log.txt");
flag = false;
}
}
}
function login($usr, $pwd) {
_setValue(_textbox("uid"),$usr);
_setValue(_password("pwd"), $pwd);
_click(_submit("Submit1"));
try {
if (_condition(_cell(_table(0), 1, 1).innerText == "The user is already logged into the system through another browser session. Do you wish to take over the session? ")) {
_click(_button("OK"));
}
} catch (e) {
}
_wait(1000);
}
login("ptuser5","manager");
_click(_link("Create Query"));
_click(_link("Advanced Conditions"));
_click(_link("Library[2]"));
_setValue(_textbox("txtSearchName"), "PT_AC1_WAC_17_04_09_0032");
_click(_submit("Search"));
_click(_cell(_table("oAdvConditions"), 0, 0));
_click(_submit("btnExecute"));
writeToFile("PT_AC1_WAC_17_04_09_0032");
_click(_submit("btnExport"));
_execute("scriptO.exe",false);
k_s("d:\\output\\" + "PT_AC1_WAC_17_04_09_0032" + ".xls");
_debugToFile("[PASSED]" ,"c:\\log.txt");
Any guess to what may be the problem is.
Thanks in advance.
- Sounav
Comments
So instead of
boolean exists = false;
use
var exists = false;