0

I need to extract an Id (100000010) in an html response which is a table as shown below:

<tr>
<tr>
<td>
<B>
100000010
</B>
</td>
</tr>
</tr>

Following xpath extractor to get this:

//*[@id="screenlet_1_col"]/table/tbody/tr[2]/td[1]/b

which is exactly what chrome gave me. But I am not able to get the value in the variable in XPath extractor.

Any help?

  • 1
    Your HTML is no HTML (there should not be nested `` tags) and does not match to your query. Have a look at http://stackoverflow.com/questions/18241029/why-does-my-xpath-query-scraping-html-tables-only-work-in-firebug-but-not-the and build the expression on your own / match it to the original HTML (or better, to the tree it will be parsed). – Jens Erat Nov 25 '13 at 09:59
  • What about '//*[@id="screenlet_1_col"]/table/tbody/tr[2]/td[1]/b/text()'? – olyv Nov 26 '13 at 12:42

2 Answers2

0

Try using CSS/JQuery extractor, to give you the expression you need to show the full HTML. It seems based on XPath you only show part of HTML code.

UBIK LOAD PACK
  • 33,980
  • 5
  • 71
  • 116
0

XPath extractor with default settings will work for valid XML or XHTML only.

If your document isn't XML-compliant you'll need to check "Use Tidy" box in your XPath Extractor

Small example:

Given following test plan structure:

  • Thread Group with 1 thread and 1 loop
  • HTTP Request to "google.com" host with "/" path and parameter "q" = "test" (or whatever)
  • Xpath Extractor with "Reference Name" = "link" and "Xpath query" = "//a"

will give you nothing on default as Google Search Results Page isn't valid XHTML.

But when you set "Use Tidy" you'll get all links as JMeter Variables with "link_" prefix like

link_1=something
link_2=something else
link_3=....

Hope this helps

Dmitri T
  • 159,985
  • 5
  • 83
  • 133