Kalsan
Kalsan

Reputation: 1039

JMeter XPath Extractor on HTML5 content

I'm trying to get JMeter to read a pre-filled form input value at the following XPath: /html/body/div[1]/div[3]/div[2]/form/table/tbody/tr[2]/td/div[1]/input/@value

Since I only got ERROR as a result, I investigated and enabled Tidy (tolerant parser) as well as verbosity (not Quiet; Report errors) and I found this:

ERROR - jmeter.util.XPathUtil: TidyException: line 65 column 9 - Error: <nav> is not recognized!
line 95 column 11 - Error: <nav> is not recognized!
InputStream: Doctype given is ""
InputStream: Document content looks like HTML 4.01 Transitional
85 warnings, 2 errors were found!
This document has errors that must be fixed before
using HTML Tidy to generate a tidied up version.

Since we are in 2017, the document is of course written in HTML5 and <nav> is a perfectly valid tag. Yet Tidy fails to recognize it. I'm running an up-to-date Arch Linux system with JMeter 3.1 r1770033.

How can I use XPath in JMeter for HTML5 websites?

Upvotes: 1

Views: 538

Answers (1)

Naveen Kumar R B
Naveen Kumar R B

Reputation: 6398

Using Xpath Extractor:

//input[@id='title_de']/@value

screenshot references: Xpath Extractor configuration: enter image description here

View Results Tree: enter image description here


Using Regular Expression Extractor:

input id="title_de" class="string optional" value="(.*?)"

Screenshot references: enter image description here

View Results Tree (highlighted the captured value): enter image description here

Upvotes: 1

Related Questions