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.
Assigning java String variables to javascript
Hi forum,
what is wrong with my script?
I execute:
var $props = new java.util.Properties();
$props.load(new java.io.FileInputStream("../userdata/config/test.properties"));
var $val = $props.getProperty("test2.dir");
_alert($val);
on the sahi controller window I see:
_alert({"bytes":[66,66,66],"empty":false,"class":undefined,"chars":null});
on the alert window:
[object Object]
test.properties contains:
test1.dir=AAA
test2.dir=BBB
test3.dir=CCC
Thanks for any hints
what is wrong with my script?
I execute:
var $props = new java.util.Properties();
$props.load(new java.io.FileInputStream("../userdata/config/test.properties"));
var $val = $props.getProperty("test2.dir");
_alert($val);
on the sahi controller window I see:
_alert({"bytes":[66,66,66],"empty":false,"class":undefined,"chars":null});
on the alert window:
[object Object]
test.properties contains:
test1.dir=AAA
test2.dir=BBB
test3.dir=CCC
Thanks for any hints
Tagged:
Comments
Use:
var $val = "" + $props.getProperty("test2.dir");
thanks for the hint.
However, var $val = $props.getProperty("test2.dir");
works with Release 2009-09-22 but not with release 2009-10-23
Will have a look. There were a few changes in the marshalling of $ variables and this bug may have been introduced. Will keep you posted.
Regards,
Narayan