Check if a Checkbox is checked or not


#1

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]


#2

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.


#3

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.


#4

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.


#5

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


#6

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 >>?