Could not identify and click the checkbox

Hello,
I tried testing a website with katalon, it was smooth and easy.Just one issue, I have trouble finding the element “checkbox” and it is not clickable.

There is two elements in the row, one is the checkbox and another is a hyperlink.

Everytime i execute the script, it always click on the hyperlink rather check on the checkbox.

CSS input: div#dnn_ctr447_ModuleContent div.conditions.conducteur_accept.form-field.-checkbox > label:nth-child(2)

Input:
//label[count(. | //[@for = ‘accept’]) = count(//[@for = ‘accept’])][count(. | //[@class = ‘legend’]) = count(//[@class = ‘legend’])][count(. | //[text() = 'J’accepte les ']) = count(//[text() = 'J’accepte les '])][count(. | id(“dnn_ctr447_ModuleContent”)/div[@class=“tunnel-wrapper -small-padding”]/div[@class=“inner”]/div[@class=“col -col-full box-accept”]/div[@class=“conditions conducteur_accept form-field -checkbox”]/label[@class=“legend”]) = count(id(“dnn_ctr447_ModuleContent”)/div[@class=“tunnel-wrapper -small-padding”]/div[@class=“inner”]/div[@class=“col -col-full box-accept”]/div[@class=“conditions conducteur_accept form-field -checkbox”]/label[@class=“legend”])][count(. | //[@id = ‘accept’]) = count(//[@id = ‘accept’])]

Error:
Unable to click on object ‘Object Repository/Tick/Page_Conducteur/label_Jaccepte les’ (Root cause: com.kms.katalon.core.webui.exception.WebElementNotFoundException: Web element with id: ‘Object Repository/Tick/Page_Conducteur/label_Jaccepte les’ located by 'By.xpath: //label[count(. | //[@for = ‘accept’]) = count(//[@for = ‘accept’])][count(. | //[@class = ‘legend’]) = count(//[@class = ‘legend’])][count(. | //[text() = 'J’accepte les ']) = count(//[text() = 'J’accepte les ‘])][count(. | id(“dnn_ctr447_ModuleContent”)/div[@class=“tunnel-wrapper -small-padding”]/div[@class=“inner”]/div[@class=“col -col-full box-accept”]/div[@class=“conditions conducteur_accept form-field -checkbox”]/label[@class=“legend”]) = count(id(“dnn_ctr447_ModuleContent”)/div[@class=“tunnel-wrapper -small-padding”]/div[@class=“inner”]/div[@class=“col -col-full box-accept”]/div[@class=“conditions conducteur_accept form-field -checkbox”]/label[@class=“legend”])][count(. | //[@id = ‘accept’]) = count(//[@id = ‘accept’])]’ not found)

1 Like

Any solution for this ?

When I have to check a checkbox I send the key space to the check.

Mageswari said:

Hello,
I tried testing a website with katalon, it was smooth and easy.Just one issue, I have trouble finding the element “checkbox” and it is not clickable.

There is two elements in the row, one is the checkbox and another is a hyperlink.

Everytime i execute the script, it always click on the hyperlink rather check on the checkbox.

CSS input: div#dnn_ctr447_ModuleContent div.conditions.conducteur_accept.form-field.-checkbox > label:nth-child(2)

Input:
//label[count(. | //[@for = ‘accept’]) = count(//[@for = ‘accept’])][count(. | //[@class = ‘legend’]) = count(//[@class = ‘legend’])][count(. | //[text() = 'J’accepte les ']) = count(//[text() = 'J’accepte les '])][count(. | id(“dnn_ctr447_ModuleContent”)/div[@class=“tunnel-wrapper -small-padding”]/div[@class=“inner”]/div[@class=“col -col-full box-accept”]/div[@class=“conditions conducteur_accept form-field -checkbox”]/label[@class=“legend”]) = count(id(“dnn_ctr447_ModuleContent”)/div[@class=“tunnel-wrapper -small-padding”]/div[@class=“inner”]/div[@class=“col -col-full box-accept”]/div[@class=“conditions conducteur_accept form-field -checkbox”]/label[@class=“legend”])][count(. | //[@id = ‘accept’]) = count(//[@id = ‘accept’])]

Error:
Unable to click on object ‘Object Repository/Tick/Page_Conducteur/label_Jaccepte les’ (Root cause: com.kms.katalon.core.webui.exception.WebElementNotFoundException: Web element with id: ‘Object Repository/Tick/Page_Conducteur/label_Jaccepte les’ located by 'By.xpath: //label[count(. | //[@for = ‘accept’]) = count(//[@for = ‘accept’])][count(. | //[@class = ‘legend’]) = count(//[@class = ‘legend’])][count(. | //[text() = 'J’accepte les ']) = count(//[text() = 'J’accepte les ‘])][count(. | id(“dnn_ctr447_ModuleContent”)/div[@class=“tunnel-wrapper -small-padding”]/div[@class=“inner”]/div[@class=“col -col-full box-accept”]/div[@class=“conditions conducteur_accept form-field -checkbox”]/label[@class=“legend”]) = count(id(“dnn_ctr447_ModuleContent”)/div[@class=“tunnel-wrapper -small-padding”]/div[@class=“inner”]/div[@class=“col -col-full box-accept”]/div[@class=“conditions conducteur_accept form-field -checkbox”]/label[@class=“legend”])][count(. | //[@id = ‘accept’]) = count(//[@id = ‘accept’])]’ not found)

Can you show us HTML code of your object?

Luis alberto guzman cristerna said:

When I have to check a checkbox I send the key space to the check.

I found out that sometimes build in WebUI.check is not working.
I replaced it with click function. I use Javascript click in my custom keyword and now it is working ok.

I found a solution (only for chrome).

I use the Click Offset function, like that.
WebUI.clickOffset(findTestObject(locator), 2, 2)

Doc:
https://docs.katalon.com/display/KD/[WebUI]+Click+Offset

Now i search a solution for Firefox

Hope this can help

crokatalontest said:

Luis alberto guzman cristerna said:

When I have to check a checkbox I send the key space to the check.

I found out that sometimes build in WebUI.check is not working.
I replaced it with click function. I use Javascript click in my custom keyword and now it is working ok.

Hi, may i have the steps to do that?