jmeter-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andre Arnold <AndreArn...@gmx.de>
Subject Re: How can I extract cell data (content surrounded by <td></td>) from a <table> in HTML response?
Date Wed, 18 Nov 2009 18:37:25 GMT
sebb schrieb:
> On 18/11/2009, rosiere <shu.yi.eutech@gmail.com> wrote:
>   
>>  Hello,
>>
>>  I found that JMeter's oro regex is somehow different from java's.
>>     
>
> Yes.
>
> But not all that different; and neither is particularly well suited to
> this task.
>
> The XPath Extractor will probably be much easier to use.
>
> http://jakarta.apache.org/jmeter/usermanual/component_reference.html#XPath_Extractor
>
> This was discussed on the mailing list earlier this year.
>
>   
>>  Now I need to iterate on different <tr> that matches a pattern, then:
>>   capture all the <td> elements within each <tr> , and select the 8th
and 9th
>>  <td>.
>>
>>  Since many <tr> elements appears in the HTML response, in order to do this
I
>>  have to capture <tr> line by line without including two lines in a same
>>  group:
>>
>>  so I should avoid capturing  continuous <tr>..</tr><tr>..</tr>
into the same
>>  group.
>>
>>  By writing (?is)<tr\sclass="tgDataLine.*1\)\" >(.*)</tr> I will capture
only
>>  one group that contains many real <tr> elements
>>  So what should I write in the regex?
>>
>>     
If you still need a pattern to match your needs.
I found that the following matches your the number you wanted and the
following column value.

reference: ref
pattern:     (?s)<TR.+?<TD.+?>([1-9|0]+?)</TD.+?<TD.+?>(.+?)</TD>
template:  $1$$2$
match :     1

In ref_g1 you'll find the number.
In ref_g2 you'll find the following column value.

To catch all the matches you need to increment a counter for the match
and check wether there is another one or not.

Your Testplan should look sth like this:

-while controller (${__javaScript("${ref}"!="error")}  )
--counter (from 1 with increment 1 for the regex match value)
--Http Sampler (to get your site)
---RegEx Extractor (as shown above)
--if controller( same as while controller--> ${ref}"!="error" )
---your jdbc action (use ref_g1 & ref_g2)


Hope I got your problem right.

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org


Mime
View raw message