You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by prasanna bhat <pr...@gmail.com> on 2010/04/18 15:49:44 UTC
Using Xpath string functions in a XPath Extractor
Hi,
I need some help in extracting a string from a HTML response and I'm using
an XPath Extractor for it.
Example:
The HTML response has the following sample content:
<html>
...
...
<input type="hidden" name="questionVersionId" value="10"
id="questionVersionId"/>
...
<input type="hidden" name="5D70C96B-BA07-4FB4-AAB7-65788B4E4FE3_md5"
value="AD0234829205B9033196BA818F7A872B"
id="5D70C96B-BA07-4FB4-AAB7-65788B4E4FE3_md5" />
...
</html
and i need to extract only the name attribute from the input field that
ends-with "_md5" (5D70C96B-BA07-4FB4-AAB7-65788B4E4FE3_md5) and value
attribute that has 32 characters (AD0234829205B9033196BA818F7A872B)
To extract the name attribute i used the XPath expression:
*ends-with(//input[@type='hidden']/@name, "_md5")*
and to extract the value attribute i used the XPath expression:
*//input[@type='hidden']/string-length(@value)=32*
Both of these expressions are not returning the required results.
I'm sorry as this question is not much related to JMeter, but i have posted
this question after i got exhausted of googling.
Thanks in advance.
Regards
Prasanna
Re: Using Xpath string functions in a XPath Extractor
Posted by prasanna bhat <pr...@gmail.com>.
I figured it out!!
//input[@type="hidden" and contains(@name,"md5")]/@name
//input[@type="hidden" and contains(@name,"md5")]/@value
Thanks,
Prasanna
On Sun, Apr 18, 2010 at 7:19 PM, prasanna bhat <pr...@gmail.com>wrote:
> Hi,
>
> I need some help in extracting a string from a HTML response and I'm using
> an XPath Extractor for it.
>
> Example:
>
> The HTML response has the following sample content:
>
> <html>
> ...
> ...
> <input type="hidden" name="questionVersionId" value="10"
> id="questionVersionId"/>
> ...
> <input type="hidden" name="5D70C96B-BA07-4FB4-AAB7-65788B4E4FE3_md5"
> value="AD0234829205B9033196BA818F7A872B"
> id="5D70C96B-BA07-4FB4-AAB7-65788B4E4FE3_md5" />
> ...
> </html
>
> and i need to extract only the name attribute from the input field that
> ends-with "_md5" (5D70C96B-BA07-4FB4-AAB7-65788B4E4FE3_md5) and value
> attribute that has 32 characters (AD0234829205B9033196BA818F7A872B)
>
> To extract the name attribute i used the XPath expression:
> *ends-with(//input[@type='hidden']/@name, "_md5")*
>
> and to extract the value attribute i used the XPath expression:
> *//input[@type='hidden']/string-length(@value)=32*
>
> Both of these expressions are not returning the required results.
>
> I'm sorry as this question is not much related to JMeter, but i have posted
> this question after i got exhausted of googling.
>
> Thanks in advance.
>
> Regards
> Prasanna
>
>
>