Check if a Checkbox is checked or not

So i have a page, where i have checkboxes, some are pre-checked some are not. Can i somehow check that it IS checked or not? If i “spy” i only get Name: value and Xpath (id(“theName”)/label[1]

Hi Francisc,

Both “verifyElementChecked” and “verifyElementNotChecked” are based on the “checked” property of the web element to verify if it is checked.

With regards to your case, the checkbox is a custom control. So the checked property may not be located within the selected element but within an element nearby it. The solution is that you should use the two above keywords with the right element that has the checked property.

Thanks.

Yes, so i tried the Element NOT Checked, and the test passed. But if i enter a step before “check” and it checks the checkbox, it still passes the Element NOT checked step.

In the Dev mode (f12) nothing changes if i check/uncheck because it is based on a Save button (have to fill out many many fields before you Save the thing)

So your version does not help in this case, or i am doing something wrong?

Edit: Same with the Verify element Checked.

Hi Francisc,

Katalon Studio has 2 built-in keywords that are used to verify if the element is checked. Please have a look at https://docs.katalon.com/display/KD/%5BWebUI%5D+Verify+Element+Checked and https://docs.katalon.com/display/KD/%5BWeb+UI%5D+Verify+Element+Not+Checked.

Thanks.

hi Francisc, i have a same problem with you…
are you have a solve fot that problem now?

Hi guys
I a have small problem
if a check box is already checked and I use check keyword to check again
what will happen >>?

Hello Hung_Pham,

I have tried to use the webUI command “verifyElementChecked” and my scenarios is to simply check that if my checkbox is selected or not.It is selected.And the error in the console is -

TempTestCase1589802855693.run(TempTestCase1589802855693.groovy:99)
Caused by: com.kms.katalon.core.exception.StepFailedException: Object ‘Object Repository/P1 Validation Checkbox/P1 Validation required_checkBoxTicked’ is not checked

Whereas in actual case my checkbox is already checked.
Tried with below xpath is -
//label[@id=‘label.ni.incident.u_validation_required’]

HTML code is -

Really stuck with this .

Hello ishta.kulshresthna,

I have the same problem with you. Did you solve?

@cansu.arslan Are you trying to determine if a checkbox, or radio, input is checked or if a label is checked? A label will not respond to WebUI.verifyElementChecked(to, 10). Look at the means how you are identifying your element, such as xpath, and see if it is an input element (likely with type as checkbox, or radio).