just the defaults. (Technically you should use the jtidy that ships with jmeter - but results should be fairly similar). You can see warnings of the sort below which tell you why it is discarding the divs/anchors
There are possibly some feature enhancements that you could request for in Bugzilla a. The ability to see the JTidy output. I recollect others have run into similar problems as you have b. The ability to use an XML tag balancer (e.g. tagsoup) instead of Tidy (which will try to make your HTML valid) - You really only need to have some sort of well formed XML for XPath to work so Tidy is overkill IMO. regards deepak Warning: discarding unexpected </td> </td> [image: warn] 1002 Warning: discarding unexpected </tr> </tr> [image: warn] 1003 Warning: discarding unexpected <tr> <tr valign="top"> [image: warn] 1005 Warning: discarding unexpected <td> <td> [image: warn] 1006 Warning: discarding unexpected <div>; Warning: discarding unexpected </div> <div class="sprite-arrow-icon"></div> [image: warn] 1007 Warning: discarding unexpected <a>; Warning: discarding unexpected plain text; Warning: discarding unexpected </a>; Warning: discarding unexpected <br> <a href=" http://www.beta.tinyprints.com/personalize/1413501/Grown-UpGlitz/saved/1c30eb971cd2629cc843a1a5e94eced7f231bceb.html">Edit</a><br /> [image: warn] 1008 Warning: discarding unexpected <div> <div class="removeCartItem"> [image: warn] 1009 Warning: discarding unexpected <div>; Warning: discarding unexpected </div> <div class="sprite-remove-icon"></div> [image: warn] 1010 Warning: discarding unexpected <a>; Warning: discarding unexpected plain text; Warning: discarding unexpected <span>; Warning: discarding unexpected <div>; Warning: discarding unexpected </div>; Warning: discarding unexpected plain text; Warning: discarding unexpected </span>; Warning: discarding unexpected </a> <a href="#" class="removeItemLink" id="7249683">Remove<span><div class="sprite-tooltip-arrow"></div>Removing this item from your cart may affect your discount.</span></a> On Wed, Oct 26, 2011 at 3:25 AM, David Luu <manga...@gmail.com> wrote: > Thanks Deepak, what option settings did you use for infohound.net/tidy? Or > just the defaults? > > On Tue, Oct 25, 2011 at 4:48 PM, Deepak Shetty <shet...@gmail.com> wrote: > > > verified . If I run your page using http://infohound.net/tidy/ then if > you > > look at the "cleaned up" HTML it produces then there is only a single > > anchor > > with the class > > > > Technically these are issues that your test tool found for you :) . if > you > > can get the dev's to fix the HTML then the XPATH should start working > > (note that XPath is memory intensive and slower as compared to a regex > post > > processor - thats fine for functional tests , not so much for load) > > > > regards > > deepak > > > > On Tue, Oct 25, 2011 at 4:40 PM, David Luu <manga...@gmail.com> wrote: > > > > > Thanks for the help Deepak. > > > > > > On Tue, Oct 25, 2011 at 4:34 PM, Deepak Shetty <shet...@gmail.com> > > wrote: > > > > > > > A cursory look shows a bunch of HTML errors including duplicate ids > > that > > > > might be impacting what TIDY does to your HTML (and the XPATH runs > over > > > the > > > > TIDY). > > > > Will need to check > > > > > > > > right now it looks If you arent sure of the order then you can always > > run > > > > two regexes . If your text is always going to be remove then you can > > use > > > > that bit of information > > > > > > > > regards > > > > deepak > > > > > > > > > > > > On Tue, Oct 25, 2011 at 4:11 PM, David Luu <manga...@gmail.com> > wrote: > > > > > > > > > Sorry, didn't know that. Here's the URL > > > > > http://dlshare.s3.amazonaws.com/shoppingCart.txt > > > > > > > > > > On Tue, Oct 25, 2011 at 3:42 PM, Deepak Shetty <shet...@gmail.com> > > > > wrote: > > > > > > > > > > > hi > > > > > > the mailing list rejects attachments. upload it somewhere and > send > > a > > > > link > > > > > > > > > > > > regards > > > > > > deepak > > > > > > > > > > > > On Tue, Oct 25, 2011 at 3:38 PM, David Luu <manga...@gmail.com> > > > wrote: > > > > > > > > > > > > > JMeter v2.5 on Windows > > > > > > > > > > > > > > Added debug sampler, it did indeed match one only (the first > item > > > in > > > > > > > shopping list, top down order): > > > > > > > > > > > > > > ORDERITEMIDS=7249682 > > > > > > > ORDERITEMIDS_1=7249682 > > > > > > > ORDERITEMIDS_matchNr=1 > > > > > > > > > > > > > > Attached is HTML from the HTTP sampler response of the shopping > > > cart > > > > > page > > > > > > > for which we extract the data. I did a text search on > > > > "removeItemLink" > > > > > > and > > > > > > > did get 3 entries for the link for 3 cart items. > > > > > > > > > > > > > > I also did a test replacing XPath extractor with regex > extractor > > > and > > > > > used > > > > > > > this pattern to do a global/multi match against: > > > > > > > > > > > > > > .+class="removeItemLink".+id="(\d+)".+ > > > > > > > > > > > > > > granted if the HTML attribute order ever changed, it would > break > > > the > > > > > > regex > > > > > > > but wouldn't break XPath. > > > > > > > > > > > > > > In the replacement, I left everything else intact, and used > same > > > > > variable > > > > > > > name for the cart items IDs. The regex version worked fine, > > getting > > > > all > > > > > 3 > > > > > > > cart items. > > > > > > > > > > > > > > So there's no loop problem for sure. Seems to be an XPath > > extractor > > > > > > problem > > > > > > > here. > > > > > > > > > > > > > > On Tue, Oct 25, 2011 at 3:16 PM, Deepak Shetty < > > shet...@gmail.com> > > > > > > wrote: > > > > > > > > > > > > > >> 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 > > > > > > >> > > > > > > > >> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > --------------------------------------------------------------------- > > > > > > > To unsubscribe, e-mail: > > jmeter-user-unsubscr...@jakarta.apache.org > > > > > > > For additional commands, e-mail: > > > jmeter-user-h...@jakarta.apache.org > > > > > > > > > > > > > > > > > > > > > > > > > > > >