Sahi Documentation

Calling custom Java code

TypeError: Cannot call property ... in object

symptom I'm trying to use java functions from sahi but I get the following error. TypeError: Cannot call property getCount in object [JavaPackage com.test.MyUtils]. It is not a function, it is "object".
cause The error message is not very intuitive, but what this means is that MyUtils is not available in the classpath. This is essentially a classpath problem.
resolution As mentioned above, MyUtils.class is not available in the classpath.
  • Ensure that your jar contains the MyUtils.class with the correct package heirarchy. You can use Export | Java | Jar facility from Eclipse to build your jar file. It will automatically create the correct package heirarchy.
  • Kindly refer to this section for details on how to add custom jars to the Sahi classpath. Ensure that you have copied the jar to the correct location.

Unable to view playback logs

symptomPlayback logs are not visible on adding Apache Xalan library externally to userdata/extlib/ folder.
cause Apache Xalan library may affect the functioning of Sahi's code to display report.
resolution To fix this, add below property line in sahi_pro/userdata/config/