Need help with "how to click multiple checkboxes based on values in an array "

I have array of strings e.g{“BANGLADESH”,“JAMACIA”}

I want to select some of the checkboxes based on the values in array.


And I am using for loop like:

And selector looks like this

It clicks on value but I would like to click inside the check box.

what the field you have spied , is it checkbox or the value ?

for some clicking on the value also works , is it not working for you?

the selector you posted is for checkbox or value ?

if it is not for checkbox spy any checkbox , provide that selector

Regards

what the field you have spied , is it checkbox or the value ?
that was something I manually wrote it and it was not working so I erased it.

for some clicking on the value also works , is it not working for you?
No it’s not working , I need to click inside the checkbox.

the selector you posted is for checkbox or value ?
it’s for value not for check box

if it is not for checkbox spy any checkbox , provide that selector
I am not quite following your question. Can you please explain it more.

spy only the checkbox not the value

if you are not to spy the particular section try changing the to UIA or AA

if none of the above works then give click offset property
for click activity in properties you can find click off set

image

use try these options or offset X and Offset Y values

Regards

@rathi.sham

Spy only the checkbox…and in that selector editor in the ui explorer page…from the centre menu you would find one row which contains the name role as one field use that as variable and it wpuld click on checkbox

Or use anchor base

Cheers

Hi @rathi.sham

Can you try this-

  1. Use the “For Each” activity to iterate through each string in the array.
  2. Inside the loop, use the “Find Element” or “Find Image” activity to locate the checkbox element on the screen. You can use selectors or image-based automation techniques, depending on the application you’re working with.
  3. Use an “If” activity to check if the current string matches the desired value for selecting the checkbox.
  4. If the condition is true, use the appropriate activity to interact with the checkbox and select it. For example, you can use the “Click” activity or set the “Checked” property of the checkbox to true.

Thanks!!!

Hi Nitya,
Is it possible for you to explain with an example?
I am little confused( in the example I just put few checkboxes, but there are almost 100 checkboxes)
Really appreciate your help.

To use spy, I believe I need Java tools. And I dont have the option to use Java tools.

@rathi.sham

When I say spy…I meant to indicate the element in ui explorer

Is that a java application? If so you need to install java extension for UiPath as well

https://docs.uipath.com/studio/v2023.4/docs/extension-for-java

Cheers

Sorry to bug you guys, I am still having problems. I just try that selector for checkbox

And this selector is for value

And this 3rd one is for both the checkbox and value

I am trying to creat a dynamic selector, which selects inside the checkbox when value matches to string in an array eg JAMACIA


This my dynamic selector which still just selecting value only not the checkbox.
I am pulling my hairs…

for check box selector , can you also post attributes present in right side section in ui explorer

if you are not aware how to do it then click on open in ui explorer

Regards

does title contains the value ?

if yes then make that dynamic how you made first

selecting aria-role and tablerow as wild card

edit : sorry not observed tablecol that you can select leaving araia-role


otherwise you have to keep the value element with dynamic role

use get attribute to get tablerow to use in the checkbox element
by making tablerow as dynamic

if you are confused at any point please let me know

Regards

@rathi.sham

Indicate the checkbox in ui explorer

Then from centre menu select each row from bottom and check the row which contains the detaila about role…that is the row you have to select and under that the checkbox selector is already present …so we can make that line where role is present as dynamic

Selector looks something like this

<webctrl tag=‘TR’ innertext=‘*{{role}}*’ />
<webctrl tag=‘td’ tablecol=‘1’ />

Note: Exact selector might be slightly different but mostly looks like this

This way the required tr is identified using role and then the checkbox under it is selected using tablecol=1.

Hope this helps

Cheers

Yes…you saved the day, I was about to lose it…
Thank you so much.

1 Like

Thanks to everybody for helping me out.
I was going insane…
Thanks again.

1 Like

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