1
votes

I need to extract the value 53177610 associated with serviceUsername from the Response Data and used XPATH Extractor as indicated below

Response Data

<input type="hidden" name="serviceUsername"

         value="53177610"> <input type="hidden"

XPATH Extractor

Reference Name:xpathserusername1

XPATH Query://input[@type="hidden"][@name="serviceUsername"]/@value

Default Value:Not Found

I get the following error SAXParseException. Assertion error: false Assertion failure: true Assertion failure message: The element type "link" must be terminated by the matching end-tag "". See log file for further details.

Is there any error in the Xpath Query that can be picked up

3
Can you post a larger snippet of xml so we can check your xpath against the document structure - Zack
Sounds like your input is HTML and likely not valid XML. - Markus
Any feedback on answer ? if ok it should be accepted and upvoted so that users know it is usable. Thx - UBIK LOAD PACK

3 Answers

1
votes

Sounds like your response is not XML/XHTML-compliant. JMeter can still deal with it, but you will need to tick Use Tidy (tolerant parser) box in the XPath Extractor

Use Tidy XPath Extractor

Given this box checked JMeter will use JTidy library to "normalize" invalid XML or HTML so your XPath query should succeed.

You can test your XPath Expressions using "XPath Tester" mode of the View Results Tree listener

XPath Tester

See Using the XPath Extractor in JMeter guide for more information on performing correlation using XPath queries

0
votes

There's nothing wrong with your query, the problem is that your input isn't well-formed XML. Perhaps it is HTML.

0
votes

For HTML the best extractor is CSS/JQuery in JMeter. XPath Extractor is for XML not HTML. Tidying has a big cost and XPath library doesn't perform as well as CSS/JQuery. Finally it is a much more maintainable and easy method, see below.

CSS/JQuery Expression will be:

input[name=serviceUsername]

And Attribute:

value

Which gives you:

enter image description here