Please note that Sahi's development and support teams do not actively monitor this. This is more a community forum. If you are a Sahi Pro user looking for commercial support, please email support @ sahipro.com with your query.

Can anyone please correct the error message indicated for the script given below.

dashboarddashboard Members
edited October 2013 in Sahi - Open Source
Can anyone please correct the error message indicated for the script given below.

Start URL
========

http://sahi.co.in/demo/training/

ERROR MESSAGE
===============
ERROR
identifier is a reserved word at Oct 16, 2013 11:01:51 AM

public static String encode (String source) {



Script
=====

_setValue(_textbox("user"), "test");
_setValue(_password("password"), "secret");
_click(_submit("Login"));
_setValue(_textbox("q"), "2");
_setValue(_textbox("q[1]"), "1");
_setValue(_textbox("q[2]"), "1");
_click(_button("Add"));
_assertExists(_textbox("total"));
_assert(_isVisible(_textbox("total")));
_assertEqual("1150", _textbox("total").value);
_click(_button("Logout"));

// onScriptEnd is a callback called by Sahi when script finishes
function onScriptEnd(){
postTestuff("atest_id", _scriptStatus());
}

public static String encode (String source) {
BASE64Encoder enc = new sun.misc.BASE64Encoder();
return(enc.encode(source.getBytes()));
}

function postTestuff(test_id, status, comment,
tester_name, branch_name, lab_name){
try {
// comment this line later;
_sahi.print(status);

// Construct data
var data = "test_id=" + encodeURIComponent(test_id);
data += "&status=" + encodeURIComponent(status);
if (comment) data += "&comment=" + encodeURIComponent(comment);
if (tester_name) data += "&tester_name=" + encodeURIComponent(tester_name);
if (branch_name) data += "&branch_name=" + encodeURIComponent(branch_name);
if (lab_name) data += "&lab_name=" + encodeURIComponent(lab_name);

// Send data
var strUrl = "https://serviceX.testuff.com/api/v0/";
var url = new java.net.URL(strUrl);
var conn = url.openConnection();
var name = "testuff_login_email";
var password = "password";
conn.setRequestProperty ("Authorization", "Basic " + encode(name + ":" + password));
conn.setDoOutput(true);
conn.setDoInput(true);
var wr = new java.io.OutputStreamWriter(conn.getOutputStream());
wr.write(data);
wr.flush();
wr.close();
// comment this line later;
_sahi.print(conn.getResponseCode());
conn.disconnect();
} catch (e) {
_sahi.print(e);
}
}


Error I am getting:
============
ERROR
identifier is a reserved word at Oct 16, 2013 11:01:51 AM

Answers

Sign In or Register to comment.