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.

Calling Java classes from Sahi

ShwethaShwetha Members
edited November -1 in Sahi - Open Source
Hi,
I am trying to use some java classes through Sahi. So I placed the class file in the util folder and tried to access a method in the class in the same way u have specified above. But I am getting an error "JSERROR TypeError: PrintName is not a function, it is org.mozilla.javascript.NativeJavaPackage." Can you please tell me how to include the class file. Also I tried to include the class by placing jar file in extlib and including the path in sahi.bat . But I am not able to access the class. I need to include some java classes for the functionality and also i need to use objects of those classes. Can u please help me how to include classes and to declare objects for any class in the Sahi script.
Tagged:

Comments

  • narayannarayan Administrators
    Shwetha, I think it is a classpath issue. Can you tell how your batch file looks after adding to classpath?
  • ShwethaShwetha Members
    Actually the problem was with how i had called the methods. Now its working fine. Its grt that we can use any java classes with the script. Thank you!
This discussion has been closed.