CS agents will respond to tickets via forum instead of private helpdesk to support other users with similar issues.

how to call object value defined in keyword into the script to print on console/log viewer.

//custom defined keyword
package testpack
public class Message

public static void PageName(String message)
    String s= "praveen"


//call of keyword in the script
def a= CustomKeywords.'testpack.Message.PageName.s'()
log.logInfo(" my name is " + a)

**it shows error **
FAILED because (of) java.lang.ClassNotFoundException: testpack.Message.PageName

_i want to call object s in the script and print in the log viewer. _


  • edited October 11
    1. You can call a static method directly using Class.method() notation
    2. You can't call s because it is a variable, not a method. If you want to get a value of s, you have to return it as method output.

      // custom keyword
      public class Message {
      public static String PageName(String message) {
      String s = "praveen"
      return s

      // keyword call
      import testpack.Message
      def a = Message.PageName("yourMessageString")
      log.logInfo(" my name is " + a)

  • It worked exactly what i was looking for. Thank you so much . Can you also look at my this query, it will be great help


Sign In or Register to comment.