Jump to content
WAPT Forum

sergei

Administrators
  • Content Count

    718
  • Joined

  • Last visited

Posts posted by sergei


  1. Hi,

     

    You can use JavaScript processing. Here is the code analogous to the “Search Parameter” function:

     

    var str = context.responseBody;//input

    var left = context.variable("left");//left boundary

    var right = context.variable("right");//right boundary

    var leftIndex = str.indexOf(left);

    var rightIndex = -1;

    if(leftIndex != -1)

    {

    rightIndex = str.indexOf(right,leftIndex+left.length);

    }

    if(rightIndex != -1)

    {

    str = str.slice(leftIndex+left.length,rightIndex);

    context.variable("str")=str;// return string

    }


  2. You need to use the $JPath function. It is not trivial but possible.

     

    XPath //*[assignedToUser/@type=null] return you all three elements with "assignedToUser" : null.

     

    XPath //*[assignedToUser/@type=null][1] return you the first element with "assignedToUser" : null.

     

    So for courseID you can use $JPath(//*[assignedToUser/@type=null][1]/application/course/id,NO).

    For applicationID you can use $JPath(//*[assignedToUser/@type=null][1]/application/id,NO).

    For approvalID you can use $JPath(//*[assignedToUser/@type=null][1]/id,NO).

     

    If it will not work for you, perhaps, you need to upgrade to the latest version of WAPT to use that.

×
×
  • Create New...