Check if a checkbox is checked or not

Hello, I’m new to I don’t really hav much coding experience.

So my case is, I had 100 checkboxes and every single checkbox has unique @value
I want to select randomize of the only one checkbox doesn’t matter which the checkbox

I’m able to do that, with first I ‘document.querySelectorAll’ all of the availables unique @value then I do the executescript that split the value and do the randomize with math.floor as a variable. lastly I checked with command check and target xpath=checkbox and myvar

And when I want to select let say 20 or 40 I just do the looping

But the problem is when I loop sometimes I encountered 1 or 2 not checked because it check the same checkbox that already checked
How can I verify the checkbox first if it’s checked or not. If it’s checked then restart the script from the start otherwise continue the script

To solve your problem you can use CHECK and UNCHECK command to have the complete control of checkbox

And with storeChecked you can check the status