Problem with 2 list boxes

Hello Friends,

i have 2 list boxes (1 list box is Available for selection & 2nd list is selected values to display) with <ul> ,<li> and <span> tags under <div> tag. So if user selects a value from list box1 and will be inserted under the 2nd list box. these values will have dynamic ids and the text will be in span tag. i have capture the object as usual and prepared the script with click event. it is working fine when I select the value from list1 to list where as it is not recognized when I deselect from list2 to list1.

can someone please gimme some ideas?

image

1 Like

Hi there,

Thank you very much for your topic. Please note that it may take a little while before a member of our community or from Katalon team responds to you.

Thanks!

What is the process of “deselect from list2 to list1”? Do you have to do something special, like drag-and-drop from one to the other, or click a button or what?

Also, the above HTML is for the list of list1 or list2?

1 Like

The original post had the following text:

i have 2 list boxes (1 list box  is Available for selection & 2nd list is selected values to display) 
with <ul> ,<li> and <span> tags under <div> tag. 

This was rendered corrupted. The HTML markups (<ul> ,<li> and <span>) were rendered invisible by Discourse.

I edited the oritinal poist to:

i have 2 list boxes (1 list box  is Available for selection & 2nd list is selected values to display) 
with `<ul>` ,`<li>` and `<span>` tags under `<div>` tag. 

Then HTML markups became visible.

1 Like

its just a click either for select deselect the value. To select click on desired value from list1 (Roles available for selection) and same will be added into list2 box (selected roles).

To deselect click on desired value from list2 box (selected roles) and same will be added into list1 box (Roles available for selection) .

Right click on the List2 item and select “Inspect”. Do this a second time to have the HTML display on your item. If “Inspect” does not show on your right click, then press the F12 key, and click on “Open DevTools” and click on the first icon at the top and then click on your element. Again, the HTML of the object should display.
If you need assistance, show this section to us to get you a pathway to your object.

Edit: can you see if the following pathway works for the first item in the List2 “drop-down”:

id("headingRolesSelected")/following-sibling::ul//li[contains(@class,"ms-selected")][1]/span

you could perhaps create an object using the pathway and then, with that TO, click on your first “drop-down” object.

here is the screenshot. Id generates dynamic

Your application was not meant to make a happy Tester. The only suggestion that I have is to use the actual word within the #2 drop-down in the pathway. As an example:

//li[contains(@class,"ms-elem-selection")]/span[normalize-space()="prakash admin"]

or

//li[starts-with(@class,"ms-elem-selection")]/span[normalize-space()="prakash admin"]

Edit: or you can try and set up a parameterization of the actual word to pass to an object: