|
Use the following script as an example of extracting a sessionID and placing that extracted value into a Custom Property. For example, from a DWR engine.js file. Refer to Script to learn how to add a script to a test clip and test composition. Note: You can get more information about DWR syntax at http://getahead.org/dwr/documentation. You can Download and import the XML for the entire Extract A Session ID Composition or just the Extract A Session ID Script or copy and paste the script code from here. XML can be imported using the SOASTA CloudTest > Repository toolbar > Import icon. Refer to Script to learn how to add a script to a test clip and test composition. |
|
|
var dwrEngineJsMessage = $context.currentClip.getChild('engine.js'); |
|
var dwrEngineJsBody = dwrEngineJsMessage.getResponse(Message.RESPONSE_HTTP_BODY); |
|
var prefix = 'dwr.engine._origScriptSessionId = "'; |
|
var startIndex = dwrEngineJsBody.indexOf(prefix) + prefix.length;
|
|
var endIndex = dwrEngineJsBody.indexOf('"', startIndex + 1);
|
|
scriptSessionId = dwrEngineJsBody.substring(startIndex, endIndex);
|
|
scriptSessionId = scriptSessionId + Math.floor(Math.random() * 1000);
|
|
$context.result.postMessage($context.result.LEVEL_INFO,
|
|
$prop.set("MessageClip", "scriptSessionId", scriptSessionId);
|