Jmeter Beanshell ---- finding Highest number from the response -


below response:

    <div class="input radio_buttons optional challenger_order_selected"><span class="radio"><input class="radio_buttons optional" id="challenger_order_selected_eulcrnhkvss5r0tqtg5obeziwwewdz09ls1usjdodytuditqdmnowe5lskzpmdvbpt0--3fb112e512edd2f77187705cbefeb5c479c85a80" name="challenger[order_selected]" type="radio" value="eulcrnhkvss5r0tqtg5obeziwwewdz09ls1usjdodytuditqdmnowe5lskzpmdvbpt0=--3fb112e512edd2f77187705cbefeb5c479c85a80" /><label class="collection_radio_buttons" for="challenger_order_selected_eulcrnhkvss5r0tqtg5obeziwwewdz09ls1usjdodytuditqdmnowe5lskzpmdvbpt0--3fb112e512edd2f77187705cbefeb5c479c85a80">54</label></span></div> <div class="input radio_buttons optional challenger_order_selected"><span class="radio"><input class="radio_buttons optional" id="challenger_order_selected_dennu2ewd3dptc8wl08ya0tkblhtzz09ls1ime5hqw5yenvfmjjdmfkyk3fzse53pt0--12dc0d52ba07f91b2957ce4a64aca7c812087239" name="challenger[order_selected]" type="radio" value="dennu2ewd3dptc8wl08ya0tkblhtzz09ls1ime5hqw5yenvfmjjdmfkyk3fzse53pt0=--12dc0d52ba07f91b2957ce4a64aca7c812087239" /><label class="collection_radio_buttons" for="challenger_order_selected_dennu2ewd3dptc8wl08ya0tkblhtzz09ls1ime5hqw5yenvfmjjdmfkyk3fzse53pt0--12dc0d52ba07f91b2957ce4a64aca7c812087239">53</label></span></div> <div class="input radio_buttons optional challenger_order_selected"><span class="radio"><input class="radio_buttons optional" id="challenger_order_selected_zc91djdxcxc3oxflazgvahqxnvbyzz09ls1mcxvtrfp1dtrfuu1jyuntrwpvcuznpt0--004c87cba6be163627a29ecf097145307e875ff0" name="challenger[order_selected]" type="radio" value="zc91djdxcxc3oxflazgvahqxnvbyzz09ls1mcxvtrfp1dtrfuu1jyuntrwpvcuznpt0=--004c87cba6be163627a29ecf097145307e875ff0" /><label class="collection_radio_buttons" for="challenger_order_selected_zc91djdxcxc3oxflazgvahqxnvbyzz09ls1mcxvtrfp1dtrfuu1jyuntrwpvcuznpt0--004c87cba6be163627a29ecf097145307e875ff0">20</label></span></div> <div class="input radio_buttons optional challenger_order_selected"><span class="radio"><input class="radio_buttons optional" id="challenger_order_selected_djvlznvtuytgvhhpn1iybnpob1nwut09ls1zwtvfl2vprfe0awdkkzbnwhlcumxrpt0--a3d2052afedd2987a5e31cfb11996ed7b9bb28e5" name="challenger[order_selected]" type="radio" value="djvlznvtuytgvhhpn1iybnpob1nwut09ls1zwtvfl2vprfe0awdkkzbnwhlcumxrpt0=--a3d2052afedd2987a5e31cfb11996ed7b9bb28e5" /><label class="collection_radio_buttons" for="challenger_order_selected_djvlznvtuytgvhhpn1iybnpob1nwut09ls1zwtvfl2vprfe0awdkkzbnwhlcumxrpt0--a3d2052afedd2987a5e31cfb11996ed7b9bb28e5">244</label></span></div> <div class="input radio_buttons optional challenger_order_selected"><span class="radio"><input class="radio_buttons optional" id="challenger_order_selected_shbjtuz1ajz5c0xuqxfuutl0bzzwut09ls1iexj0svdlnuzbzhjta2oryvg4utvbpt0--4bcb59d227c1658800f0c2a4d9ca70c59b002d22" name="challenger[order_selected]" type="radio" value="shbjtuz1ajz5c0xuqxfuutl0bzzwut09ls1iexj0svdlnuzbzhjta2oryvg4utvbpt0=--4bcb59d227c1658800f0c2a4d9ca70c59b002d22" /><label class="collection_radio_buttons" for="challenger_order_selected_shbjtuz1ajz5c0xuqxfuutl0bzzwut09ls1iexj0svdlnuzbzhjta2oryvg4utvbpt0--4bcb59d227c1658800f0c2a4d9ca70c59b002d22">101</label></span></div> 

i need find highest number list 244 , respective dynamic value "djvlznvtuytgvhhpn1iybnpob1nwut09ls1zwtvfl2vprfe0awdkkzbnwhlcumxrpt0=--a3d2052afedd2987a5e31cfb11996ed7b9bb28e5". can please me how write bean-shell same

you can use xpath extractor to:

  1. identify label largest value
  2. get "value" attribute of relevant input
  3. both points 1 , 2 can done in single expression

example xpath expression above like:

//div/span/label[not(text() <= ../../preceding-sibling::div/span/label/text()) , not(text() <=../../following-sibling::div/span/label/text())]/../input/@value 

disclaimer: above expression work against response data mentioned in question, if actual response has different markup - might not accurate.

evidence:

xpath extractor evidence

warning: xpath expression memory , resource intensive, use wisely.

references:


Comments

Popular posts from this blog

javascript - Slick Slider width recalculation -

jsf - PrimeFaces Datatable - What is f:facet actually doing? -

angular2 services - Angular 2 RC 4 Http post not firing -