Search code examples
jmeterbeanshell

Entire page response to string?


In beanshell is it possible to dump the contents of the entire page into a String?

Something like:

String entirePage = vars.get(entire-page)

Solution

  • If you're doing it in Beanshell PostProcessor, it has data pre-defined variable which stands for byte array containing parent sampler response.

    So something like:

    String entirePage = new String(data);
    vars.put("entire-page", entirePage);
    

    should do the trick for you.

    Another approach you can take is using Regular Expression Extractor. As per How to Extract Data From Files With JMeter guide regular expression which matches literally everything will look as (?s)(^.*)