regexxpathjmeterbeanshellextractor

jmeter grab value from response data


I have a question about grabbing a certain value from the html response data in Jmeter. I've been trying both regular expression and xpath extractor(see below) but having no luck.

This is part of the response data I receive:

<table border="0" cellpadding="2" cellspacing="1" style="border-collapse: collapse" id="AutoNumber2" bordercolorlight="#999999" bordercolordark="#999999" width="100%">
   <tr> 
      <td class="head" align="center" colspan="2">Routing Sheet</td>
   </tr>

   <tr class="altrow"> 
      <td align="right" width="50%" class="formtext">Today's Date:</td>
      <td valign="top" width="50%" class="formtext">06/19/2012</td>
   </tr>

   <tr class="altrow"> 
      <td align="right" width="50%" class="formtext"> HCSC Received Date:</td>
      <td valign="top" width="50%" class="formtext">06/19/2012</td>
   </tr>

   <tr class="tablerow"> 
      <td align="right" width="50%" class="formtext"> Package Log Date:</td>
      <td valign="top" width="50%" class="formtext">06/19/2012 04:21PM</td>
   </tr>

   <tr class="altrow"> 
      <td align="right" width="50%" class="formtext"> Group Specialist:</td>   
      <td valign="top" width="50%" class="formtext">WATTS, JOHN</td>            
   </tr>

   <tr class="tablerow"> 
      <td align="right" width="50%" class="formtext"> Case Underwriter:</td>
      <td valign="top" width="50%" class="formtext">N/A</td>           
   </tr>    

   <tr class="altrow"> 
       <td align="right" width="50%" class="formtext"> Medical Underwriter:</td>  
       <td valign="top" width="50%" class="formtext">N/A</td>    
   </tr>

   <tr class="tablerow"> 
       <td align="right" width="50%" class="formtext">Case Number:</td>                           
       <td valign="top" width="50%" class="formtext">7402628</td>
   </tr>

And I'm trying to grab the case number. I have been trying the regex extractor:

Case Number:</td><td valign="top" width="50%" class="formtext">(.+?)</td>

But got a null value back.

And for xpath extractor I tried this:

//table[@id='AutoNumber2']/tbody/tr[8]/td[2]

but it's not working either. I've been thinking of using Beanshell to grab the source code as a string and parse the number. Is there any better way of grabbing that number? And how can I use beanshell to grab the source code of the response data? I tried using xpath of /html but have no luck.

Thanks a lot


Solution

  • Try this xpath:

    //table[@id='AutoNumber2']/tr[8]/td[2]