0
votes

Using jmeter, I have a variable that is obtained by xpath expression. I have then used beanshell post processor to then get a substring (last 4 characters) which will be used in another request. However, I keep getting an method invocation error for the script below.

      import org.apache.jmeter.util.JMeterUtils;
      import java.lang.*;
      import java.io.*;

      String numb = String.valueOf(vars.get("num"));
      String last4 = num.Substring(num.length()-4, num.length());
      log.info("num");

Any ideas as to what I'm doing wrong?

1

1 Answers

0
votes

Added the correct libraries, which is as follows:

import org.apache.jmeter.util.JMeterUtils; import org.apache.commons.lang3;

Change the start and end index values as well