what version of Jmeter? Dont go by Firebug it looks at the DOM whereas JMeter will have to look at the source html .
Add a Debug Sampler under your HTTP Sampler and also add a view results tree listener. If your debug sampler shows your multiple values correctly the problem is in the loop If your debug sampler only shows a single value , then you need to look at the HTML response (in view results tree listener) that your xpath extractor is a child of and see if you have multiple nodes satisfying your condition or your HTML is different from what you expect. If the HTML looks right , then upload a copy of the html and send the link regards deepak On Tue, Oct 25, 2011 at 1:27 PM, David Luu <manga...@gmail.com> wrote: > Hi, just wanted to check to see if I misconfigured something or XPath > defined correctly. Here's the setup: > > We have HTTP request sampler to hit user's shopping cart that returns HTML > in response. The HTML is dynamic based on what user already has in cart. > > I want the JMeter test to remove items in cart, and we do that by fetching > the item ID stored in the links to then remove item by make HTTP POST in > another sampler with the item ID. The XPath is as follows: > > //a[@class='removeItemLink']/@id > > We identify the item ID as an attribute in links with class type > 'removeItemLink'. Unfortunately, or to play it safe, we don't know if the > generated HTML always has same fixed pattern text of whether the class > attribute is always before or after the ID attribute, hence I chose to use > XPath extractor rather than a regular expression extractor to get the ID. > ID > value is also dynamic and may not be fixed length. > > I enabled Tidy with quiet mode. Later also enabled report errors show > warnings, and disabled quiet mode, those options didn't help. The UI and > the > docs don't mention anything about settings to match once or match all, etc. > So believe matching number determined by the XPath expression. > > used XPath extracted variable reference name ORDERITEMIDS > > and then had a ForEach controller run a HTTP request sampler to POST to API > to remove items. But during execution, it only ran once, but it did work > correctly for the one item that it extracted. ForEach controller configured > as follows: > > input var prefix = ORDERITEMIDS > output var name = returnVar > checked add "_" before number > > and in HTTP sampler inside the foreach, reference variable as ${returnVar} > > I tested the XPath with Firebug in Firefox and it matched all the items in > the cart unlike JMeter, and I know the basics of XPath, and that appears to > be the correct XPath. > > So is this a bug with JMeter or am I doing something wrong? Or wrong XPath > somehow still? > > Regards, > David >