Have to check all checkbox in a webpage. Each webpage page have different number of check box. How to achieve through UiPath?

I want to check checkbox automatically in a webpage. Each webpage is having different number of checkboxes. I have tried to inject Javascript to webpage. But Javascript is not working with UIpath. But Manually when i enter the same code in the webpage ,using viewcode of webpage and run javascript it works good. All checkboxes get checked. when ever i use option ‘inject js’ in UIpath it fails. Below is my code.

Any Suggesstion would be great help for me.
Thank you

var allInputs =document.querySelectorAll(‘input[type=checkbox]’);
for (var i = 0, max = allInputs.length; i < max; i++){
if (allInputs[i].type === ‘checkbox’)
allInputs[i].checked = true;
}

1 Like

Hi,

You can use Check activity and Keep the option as check and the selector you can make sure it is dynamic so that it work for all the check box

Regards
Shanmukh

2 Likes

Thank you for your kind reply. but when i did that i got this error

RemoteException wrapping UiPath.Core.ElementOperationException: Attribute not supported by the current UiNode. —> RemoteException wrapping System.Runtime.InteropServices.COMException: Attribute not supported by the current UiNode.

1 Like

@ANTONY_JOSEPH… Which version of Uipath you are using ?

1 Like

Studio 2019.10.4 - 2/6/2020
Enterprise Trial License
Windows Installer

Microsoft Windows Server 2019 Datacenter 64-bit
.NET Framework Version 4.7.2 or later

1 Like

Studio 2019.10.4 - 2/6/2020
Enterprise Trial License
Windows Installer

Microsoft Windows Server 2019 Datacenter 64-bit
.NET Framework Version 4.7.2 or later

1 Like

@ANTONY_JOSEPH Then it is related to selector issue only, it might be not pointing to correct node
Please check for one checkbox first and if does not work then can you add the screenshot
or
use get attributes to know if the checkbox is selected or not and then use click activity

3 Likes

okay

1 Like

Hi,

You can use FindElement Activity to get all Decendants and then dynamically iterate through them that are checkboxes and click on them.
Pls have a look at the xaml attachedMain.xaml (8.8 KB)

4 Likes

Thank you very much i was looking for this stuff. But i have few problems left as im new in uipath. Im attaching screenshoots of things that i have tired. I still have problem with checkbox selection. can you figure it out. it will be great help for me.

Thank you

1 Like

Not sure what the problem is with the selction, can you explain in more detail?
According to your screenshots it seems that you did not set a valid selector into the variable ‘selector’.
A selector is more than just an id.

3 Likes

I would use the following approach:
In a sandbox workflow I would learn how to check an individual checkbox in given web page - either using Click activity or Check activity.
In a sandbox workflow I would learn how to select all checkboxes in a loop - e.g. using Highlight activity.
Finally I would combine the above.

1 Like

Thank you very much for your help. I have tried as per your suggestion , but some minor issues are there. checkbox not getting selected. I’m attaching my file. Kindly go through and give some suggestion where i have to change[

Thank you
Flowchart11.xaml (3.9 KB)

1 Like

Antony,
the xaml you sent is empty.

1 Like

I’m so sorry , wrongly uploaded. please find the below one.

Thank you

uipath_upload.xaml (9.8 KB)

1 Like

Antony,

your xaml looks pretty much like mine - so the question is:
what is the issue you are facing atm?
Does it fail with not finding the control?
Does it pass but not click on the element?

2 Likes

Clicking on check box is not performing.

1 Like

if you haven’t resolved this. I had a similar case and you may try these steps to resolve it. (I assume that you only wanna check all check boxes without any other specific id.)

  1. In the Find Children add Input Filter <webctrl tag='INPUT' />
  2. For Each child just put Check with Target Element by child.

pls let me know if this works for your case. :upside_down_face: