Working with buttons within a selection bar

Hi folks,

I’m fairly new with UiPath and I’m having some issues with manipulating some buttons on a webpage - the search/selection bar (“select2-selection__rendered”) has LI classes for each button (“select2-selection__choice”), and each button has a span class (“×”) which will remove that selection.

image

What I’m trying to do is get the name of each button within the selection bar (ie. “Non KAM” and “School”) and if it doesn’t exist within an array of pre-determined values, then click on the × to remove the button. I have tried using Get Children with FIND_DESCENDANTS and then trying to do a For Each based on the UiElement, but I can’t seem to scope the selector correctly - I’m not sure if that’s even the correct way of doing this though.

Any help would be appreciated!

Screenshot of the selection bar for reference: image

Have you tried using Get Attribute activity to get the values from the selector? @Steven_Bruce

Hi @HareeshMR - yes, with the above selector I can get the innertext which in this example would contain “×Non KAM×School”. I can split that output to an array using the × as a delimiter, but the part I don’t understand would the process to click on the preceeding × to remove the button from the webpage if the array item is not an accepted value.

Adding buttons to this web element is easy, so maybe it would be sensible to just remove all buttons, then if an accepted value is present within the array, add it back in.

Managed to get this working, by removing all buttons by clicking on the first X in the element until no more remain, then re-adding any that previously existed and were on the required list.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.