Extract from Response Body (HTML)

This is an example of a script that extracts an element from a page response and sets a clip property. This is a versatile example because you can change the xpath to extract different elements.

var msg = $context.currentItem.previousItem;
var passwordValue = msg.getResponse(msg.RESPONSE_HTTP_BODY_AS_HTML, "//*[@id='soasta-password']")[0];
// passwordValue now contains the string that you want; put it in a clip property
$prop.set("MessageClip", "password", passwordValue);

A slight variation of this script that extracts an id from an HTML page:

var msg = $context.currentItem.previousItem.previousItem;
var semesterInputValue = msg.getResponse(msg.RESPONSE_HTTP_BODY_AS_HTML, "//*[@id='term_13']/@value")[0];
// semesterInputValue now contains the string that you want; put it in a clip property
$prop.set("MessageClip", "term", semesterInputValue);
$context.result.postMessage($context.result.LEVEL_INFO, "sem: " + semesterInputValue);