1

Are there any techniques that can be used to log in to a website with JMeter, when you are asked for the x,y,z characters of the password?

edit: a little more info: I'm recording HTTP requests, and for our local environment you just login with the password, which works fine. For the "live" site it asks for random different characters.

UBIK LOAD PACK
  • 33,980
  • 5
  • 71
  • 116
pecks
  • 318
  • 1
  • 2
  • 9
  • Possible duplicate of [jmeter testcases which can handle captcha?](https://stackoverflow.com/questions/6964358/jmeter-testcases-which-can-handle-captcha) – Ori Marko Aug 31 '17 at 10:02
  • similar, in that it appears to be something that we can't automate. – pecks Aug 31 '17 at 10:10

1 Answers1

1

In order to implement what you want you have to proceed this way:

def start = vars["start"];
def end = vars["end"];
def password = vars["password"]; // This can come from a CSV or be hard coded if it does not change
vars.put("passwordExtract", password.substring(start, end));
  • You can then use ${passwordExtract} to input the value in next request
UBIK LOAD PACK
  • 33,980
  • 5
  • 71
  • 116
  • The password isn't random, it's always the same. But each time I login I get asked for different characters, e.g. the 1st, 3rd and 4th. Next time in it might be the 2nd, 5th and 6th characters that are asked for. – pecks Aug 31 '17 at 10:09
  • You mean there is a question asking you this in the application ? a kind of captcha ? – UBIK LOAD PACK Aug 31 '17 at 10:11
  • Yes. So when we run it locally it asks for the password, so I can just send that in the POST. But when it is deployed it asks for 3 characters from the password - a different 3 each time. – pecks Aug 31 '17 at 10:16
  • I changed my answer – UBIK LOAD PACK Aug 31 '17 at 11:27
  • I accepted this as the answer. We ended up with a BeanShell PreProcessor, and the logic is slightly different (it doesn't want a substring of the password, it wants certain characters). – pecks Sep 01 '17 at 07:40
  • Thanks for feedback but you should really not use Beanshell as it does not scale correctly. Use Groovy and check "Cache...." instead. Groovy outperforms beanshell by at least a factor of 10 – UBIK LOAD PACK Sep 01 '17 at 07:50
  • thanks again, it does look pretty slow, I will try to convert the BeanShell – pecks Sep 01 '17 at 11:07