jmeter use regex to get link text -
i want utilize jmeters regular look extractor grab link http response have. how grab whats within <a href="text"></a>
? want text.
<a([^>]+)>(.+?)<\/a>
the look above gives me whole link a
tag , href.
i rather recommend not using regular expressions getting info html href
attribute may located in differently, @ new line, etc. see epic comment on detailed explanation.
jmeter provides 2 test elements can used extract href
attribute html page links:
xpath example
add xpath extractor kid of request (just regular look extractor) configure follows: if response not xhtml compliant - checkuse tidy
box reference name - meaningful, i.e. href
xpath query - //a/@href
you can refer extracted link url ${href}
anywhere in current thread group. in case of multiple matches urls can accessed ${href_1
} ${href_2}
etc. for more info on xpath extractor see using xpath extractor in jmeter guide
css/jquery example
add css/jquery extractor kid of request configure follows: reference name - variable name, i.e.href
css/jquery look - a
attribute - href
match no: default blank
- homecoming first link any number > 0
- homecoming match number 0
- homecoming random link url -1
- homecoming link urls , store them ${href_1
} ${href_2}
etc. for css/jquery expressions building info refer jsoup selector syntax guide
regex jmeter
No comments:
Post a Comment