18 January 2026:


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.

Method setInitJS of TestRunner in Java is not working with Sahi Pro Starter and Sahi Pro

Hi community team.

I am using Sahi Pro Starter version 7.0.1 and Sahi Pro 7.5.0 to test the passing of variables to Sahi script from java class net.sf.sahi.test.TestRunner using method setInitJS(). However, when I start Sahi Pro Starter and execute the following Java program.

java.png
https://pastebin.com/3pAb5KEW

Sahi generates error ReferenceError: "$userName" is not defined. As described in the image below.

log_error.png

I am using the following Sahi script (demo.sah):

sahi_script.png
https://pastebin.com/QSQUR7dg

I think Sahi is not injecting the variables I set in TestRunner's initJS method. Also, this problem happens with Sahi Pro 7.5.0 and I have tried with browsers: chrome, firefox and ie. But when I execute the same Java program with Sahi OS 5.1, the script finish successfully.

Can you tell me is this is in issue in this version of Sahi or what can I do to solve it?.

I wait for your kind response, thanks.
Angel Gil
Sign In or Register to comment.