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.
How to use JAR file?
i dont know javascripting and java. i am not a programer
but need use that things to test web pages.
i need use dummy text (google: Lorem Ipsum)] to test web pages. They have JAVA class (free to use).
can somebody show me Step-by-step what i need write in sahi script?
somehow i made JAR file (LoremIpsum.jar) and put him to C:\jarFile directory;
also i make changes in file start_dashboard.bat : SET SAHI_EXT_CLASS_PATH=C:\jarFile
in CMD window i use command "java -jar LoremIpsum.jar" and it return me dummy text.
but how it do in SAHI script i dont know.
plz help.
but need use that things to test web pages.
i need use dummy text (google: Lorem Ipsum)] to test web pages. They have JAVA class (free to use).
can somebody show me Step-by-step what i need write in sahi script?
somehow i made JAR file (LoremIpsum.jar) and put him to C:\jarFile directory;
also i make changes in file start_dashboard.bat : SET SAHI_EXT_CLASS_PATH=C:\jarFile
in CMD window i use command "java -jar LoremIpsum.jar" and it return me dummy text.
but how it do in SAHI script i dont know.
plz help.
This discussion has been closed.
Comments
You should record script, instead of writing anything.
Then you replay your script.
In simple cases you dont need anything to change.
In worse cases, you need very basic knowledge of javascript.
Please refer to
http://sahi.co.in/w/sample-videos
Lech
any way, how use JAR file?
Have a look at this: http://sahi.co.in/w/sahi-scripting-calling-java
Check if this helps you.
Regards
Sumitra
From the below code :
Packages.java.lang.System.out.println("Through Java: " + s);
"java.lang" is already a part of java . You dont need any external JAR file.
Regards
Sumitra
Here is how you can achieve what you want.
1) Download loremipsum-1.0.zip from http://sourceforge.net/projects/loremipsum/files/latest/download
2) Extract the zip file and copy loremipsum-1.0.jar to sahi/extlib/lorem (You need to first create the folder "lorem" in extlib)
3) Open sahi/userdata/bin/start_dashboard.bat and change
SET SAHI_EXT_CLASS_PATH=
to
SET SAHI_EXT_CLASS_PATH=%SAHI_HOME%\extlib\lorem\loremipsum-1.0.jar
4) Restart Sahi
5) Create a file lorem.sah in sahi/userdata/scripts directory, and copy this content into it:
6) If you playback lorem.sah, you will see
"Lorem ipsum dolor sit amet,"
alerted on the browser.
To explain:
var $lorem = new Packages.de.svenjacobs.loremipsum.LoremIpsum();
creates a LoremIpsum object and assigns it to variable $lorem.
We then invoke the getWords method on it.
Here we are passing $text to _alert so that we can easily see the result. You can use it anywhere in the sahi script; for example, you could pass into _setValue like this:
_setValue(_textarea("id"), $text);
The other methods in LoremIpsum are explained here: http://loremipsum.sourceforge.net/apidocs/
Hope that helps.
Regards,
Narayan