Highlighted
Absent Member.
Absent Member.
1139 views

AJAX Truclient selection on different categories

Hello,

If application consists of  checkboxes with two different categories and need to pick only one set of categories and move further.

For example:

Hello All,

AJAX Truclient Evalxpath to differentiate category and pick all same category checkboxes.

Below is xpath i get when i check evalxpath"

 evalXPath("//input[@type=\"checkbox\" and @value=\"8539fc082ed57f0591bc12b7e516a3680ef6\"]");

But i want to differentiate two(IN & OUT STOCKS) different categories, from below three stocks, i need to pick number of In stock category (IN stock changes with users, they are not constant) only.

     <td>In Stock</td>
         <td><input type="checkbox" name="bookId[]" value="8539fc082ed57f0591bc12b7e516a3680ef6"
 <td>Out Stock</td>
         <td><input type="checkbox" name="bookId[]" value="8539fc082ed57f0591bc12b7e516a3680ef6"
 <td>In Stock</td>
         <td><input type="checkbox" name="bookId[]" value="8539fc082ed57f0591bc12b7e516a3680ef6"

Please let me know how to write the evalXpath for above tag

Thanks

Sai

0 Likes
8 Replies
Highlighted
Honored Contributor.
Honored Contributor.

Re: AJAX Truclient selection on different categories

Basically you should use JavaScript to pick a random index. Here is a similar example: http://www.tableaututorialforbeginners.com/how-to-select-a-random-value-from-dropdown-list-using-truclient-protocol-in-loadrunner/

Igor Markov
R&D Manager, Performance Engineering Core
0 Likes
Highlighted
Absent Member.
Absent Member.

Re: AJAX Truclient selection on different categories

Hello Igor,

Thanks for the reply.

Basically i want the eval xpath to pick only "Instock" values.  Currently with existing evalxpath it picks both the categories.

in other words:

Application has a list of values with two categories "instock and outstock" categories.

on a page it displays around 10 Values with random number of "In" & "OutStock" categories.

So, from the list of 10 values i need to pick below mentioned category.

1) First it should pick only "Instock" categories values not "Outstock" categories.

2) second no. of "Instock" categories values.

 

Regards,

Sai

0 Likes
Highlighted
Absent Member.
Absent Member.

Re: AJAX Truclient selection on different categories

similar applciation in web protocol can be managed with below points, but the requirement is on AJAX Truclient protocol.

If it was WEB protocol,

Leftboundary  would be 

Ex: LB= "<td>In Stock</td>\r\n<td><input type="checkbox" name="bookId[]" value="   to pick only one of the category and 

write custome request to get all the values of same category.

Similarly how to differentiate the category in AJAX Truclient and write a loop to pick all the values.

Thanks again.

0 Likes
Highlighted
Outstanding Contributor.
Outstanding Contributor.

Re: AJAX Truclient selection on different categories

Hi saireddy509,

If I understand correctly, you're interested in selecting a checkbox based on the content of <TD> tag before it.

for the code you indicated, this XPATH string may suit your needs:

//td[.='Out Stock']/following-sibling::td[position()=1]//input[@type="checkbox" and @value="8539fc082ed57f0591bc12b7e516a3680ef6"]

Note it selects all the checkboxes that have such a <TD> tag before them.

To select a specific one, apply relevant XPATH.

I suggest learning more about XPATH online.

Edo

0 Likes
Highlighted
Absent Member.
Absent Member.

Re: AJAX Truclient selection on different categories

Hello Edo,

Thanks for the reply.

Can you please see the screenshot attached, from which i need to pick all instock values...

instock values TD would be like this:

 <td>In Stock</td>
         <td><input type="checkbox" name="bookId[]" value="8539fc082ed57f0591bc12b7e516a3680ef6"
 <td>Out Stock</td>
         <td><input type="checkbox" name="bookId[]" value="8539fc082ed57f0591bc12b7e516a3680ef6"
 <td>In Stock</td>
         <td><input type="checkbox" name="bookId[]" value="8539fc082ed57f0591bc12b7e516a3680ef6"

 

0 Likes
Highlighted
Outstanding Contributor.
Outstanding Contributor.

Re: AJAX Truclient selection on different categories

Hi Sal,

The solution I gave you should work for this page as well.

Again, note that it will select all "Out Stock" checkboxes and you'll need to implement the specific selection per your business needs.

Perhaps if you supply more information about the selection required, i can help further.

 

Edo

 

0 Likes
Highlighted
Absent Member.
Absent Member.

Re: AJAX Truclient selection on different categories

Hello Edo,

 

Can you please see the screenshot in my last post.

Now the requirement is from the list, i need to pick all the INSTOCK and click Next.

 

0 Likes
Highlighted
Outstanding Contributor.
Outstanding Contributor.

Re: AJAX Truclient selection on different categories

Hi saireddy509,

Select multiple items can be acheived by either writing custom JavaScript code, or using a TruClient For Loop step.

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.