# Unable to click a check box

**URL:** <https://forum.katalon.com/t/unable-to-click-a-check-box/31662>\
**Category:** Web Testing\
**Tags:** katalon-studio\
**Created:** [August 16, 2019, 12:24pm UTC](https://forum.katalon.com/t/unable-to-click-a-check-box/31662 "2019-08-16T12:24:04Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![Richard.QA](https://avatars.discourse-cdn.com/v4/letter/r/35a633/32.png) [@Richard.QA](https://forum.katalon.com/u/Richard.QA)\
**Post date:** [August 16, 2019, 12:24pm UTC](https://forum.katalon.com/t/unable-to-click-a-check-box/31662/1 "2019-08-16T12:24:04Z")

</div>

I am unable to make the script click the check box, I had tried 3 ways.

 ![error-003](https://europe1.discourse-cdn.com/katalon/original/2X/c/ccaa676f930035318e4b2a0c65cf75689ce6a434.jpeg) ![error-004](https://europe1.discourse-cdn.com/katalon/original/2X/7/78c85d4f65ded4f579e7d4eae5a7a56245f60acc.jpeg) ![rs](https://europe1.discourse-cdn.com/katalon/original/2X/2/266f64261b2c485298d0efe74f61734d1580a07f.png)

I do something like this:  
//Scroll to element

WebUI.scrollToElement(findTestObject(‘Object Repository/100/Page\_Review your order/input\_Rules of purchase-sale of goods at IKEA online store\_btnreview’), 3)  
WebUI.delay(1)

//click the element.  
WebUI.click(findTestObject(‘Object Repository/100/Page\_Review your order/label\_Ive read and understood Rules of purchase-sale of goods at IKEA online store’))

//I also tried with check  
WebUI.check(findTestObject(‘Object Repository/100/Page\_Review your order/input\_Rules of purchase-sale of goods at IKEA online store\_btnreview’))

//and with a off set  
[//WebUI.clickOffset](https://WebUI.clickOffset)(findTestObject(‘Object Repository/100/Page\_Review your order/input\_Rules of purchase-sale of goods at IKEA online store\_btnreview’), 863, 1243)

But the checkbox do not want to be marked. I got the commands with the record web button, and put the

---

<div class="post-metadata">

**Author:** ![Brandon\_Hein](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/brandon_hein/32/1092_2.png) [@Brandon\_Hein](https://forum.katalon.com/u/Brandon_Hein)\
**Post date:** [August 16, 2019, 7:40pm UTC](https://forum.katalon.com/t/unable-to-click-a-check-box/31662/2 "2019-08-16T19:40:19Z")

</div>

Can you share a screenshot of the “label\_Ive read and understood Rules of purchase-sale of goods at IKEA online store” Test Object?

---

<div class="post-metadata">

**Author:** ![francorebu](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/francorebu/32/16103_2.png) [@francorebu](https://forum.katalon.com/u/francorebu)\
**Post date:** [August 17, 2019, 4:17am UTC](https://forum.katalon.com/t/unable-to-click-a-check-box/31662/3 "2019-08-17T04:17:56Z")

</div>

try to add and element manually in the object repository  
name it “checkbox\_iHaveRead”  
select xpath option and paste there the xpath: //\*[@id=‘checktermscond’]  
save the element  
then try to click on the element saved “checkbox\_iHaveRead”

---

<div class="post-metadata">

**Author:** ![Richard.QA](https://avatars.discourse-cdn.com/v4/letter/r/35a633/32.png) [@Richard.QA](https://forum.katalon.com/u/Richard.QA)\
**Post date:** [August 19, 2019, 6:38am UTC](https://forum.katalon.com/t/unable-to-click-a-check-box/31662/4 "2019-08-19T06:38:06Z")

</div>

Of course,  
This is the code inside: /Object Repository/100/Page\_Review your order/label\_Ive read and understood Rules of purchase-sale of goods at IKEA online store . This was done with the record function of Katalon.

The large line that you can not see on the image:  
id("checkout")/div[@class="row justify-content-center"]/div[@class="review\_section col-12 col-lg-6 offset-lg-1"]/div[@class="terms-conditions\_section"]/div[@class="checkbox m-0 my-0"]/label[@class="text"]

 ![rs](https://europe1.discourse-cdn.com/katalon/original/2X/2/266f64261b2c485298d0efe74f61734d1580a07f.png)

---

<div class="post-metadata">

**Author:** ![Richard.QA](https://avatars.discourse-cdn.com/v4/letter/r/35a633/32.png) [@Richard.QA](https://forum.katalon.com/u/Richard.QA)\
**Post date:** [August 19, 2019, 8:00am UTC](https://forum.katalon.com/t/unable-to-click-a-check-box/31662/5 "2019-08-19T08:00:28Z")

</div>

Something like this:

WebUI.selectOptionByLabel(findTestObject(‘checkbox\_iHaveRead’), ‘’, true)

 ![error-006](https://europe1.discourse-cdn.com/katalon/original/2X/e/eb7a3d3b048b1dc989badd53d5a92c2d6d153ecd.jpeg)  
 ![error-007](https://europe1.discourse-cdn.com/katalon/optimized/2X/6/6d95188274b5e712f869b61481b6069669b3e5b6_2_690x70.jpeg)

I changed to this:  
…XPATH  
//\*[@id=‘checktermscond’]  
…  
Test Cases/Buy-003 FAILED.  
Reason:  
com.kms.katalon.core.exception.StepFailedException: Unable to check object ‘Object Repository/checkbox\_iHaveRead’  
at com.kms.katalon.core.webui.keyword.internal.WebUIKeywordMain.stepFailed(WebUIKeywordMain.groovy:64)  
at com.kms.katalon.core.webui.keyword.internal.WebUIKeywordMain.runKeyword(WebUIKeywordMain.groovy:26)  
at com.kms.katalon.core.webui.keyword.builtin.CheckKeyword.check(CheckKeyword.groovy:88)  
at com.kms.katalon.core.webui.keyword.builtin.CheckKeyword.execute(CheckKeyword.groovy:67)  
at com.kms.katalon.core.keyword.internal.KeywordExecutor.executeKeywordForPlatform(KeywordExecutor.groovy:56)  
at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords.check(WebUiBuiltInKeywords.groovy:1039)

---

<div class="post-metadata">

**Author:** ![Nilau](https://avatars.discourse-cdn.com/v4/letter/n/bb73d2/32.png) [@Nilau](https://forum.katalon.com/u/Nilau)\
**Post date:** [August 19, 2019, 6:44pm UTC](https://forum.katalon.com/t/unable-to-click-a-check-box/31662/6 "2019-08-19T18:44:44Z")

</div>

I think WebUI.selectOptionByLabel is for dropdown list and not checkbox.

> **[\[WebUI\] Select Option By Label](https://docs.katalon.com/katalon-studio/docs/webui-select-option-by-label.html)**
>
> Description  Select the options with the given label (displayed text). Parameters Param Param Type Mandatory Description to TestObject Required Represent a web element. labelText String Required Displayed text of the...

---

<div class="post-metadata">

**Author:** ![Richard.QA](https://avatars.discourse-cdn.com/v4/letter/r/35a633/32.png) [@Richard.QA](https://forum.katalon.com/u/Richard.QA)\
**Post date:** [August 20, 2019, 10:23am UTC](https://forum.katalon.com/t/unable-to-click-a-check-box/31662/7 "2019-08-20T10:23:21Z")

</div>

> [@Nilau](#):
>
> I think WebUI.selectOptionByLabel is for dropdown list and not checkbox.

Yes, i have tried also with manually element like @ [francorebu](http://forum.katalon.com/u/francorebu) recomend.  
WebUI.check(findTestObject(‘checkbox\_iHaveRead’))  
WebUI.click(findTestObject(‘checkbox\_iHaveRead’))

But do not want to work…

---

<div class="post-metadata">

**Author:** ![shanu](https://avatars.discourse-cdn.com/v4/letter/s/b9e5f3/32.png) [@shanu](https://forum.katalon.com/u/shanu)\
**Post date:** [August 29, 2019, 4:16pm UTC](https://forum.katalon.com/t/unable-to-click-a-check-box/31662/8 "2019-08-29T16:16:42Z")

</div>

@Richard.QA : I have the same problem , unable to click or check the checkbox in Katalon , is your problem solved ? if you have the solution please let me know.

---

<div class="post-metadata">

**Author:** ![shanu](https://avatars.discourse-cdn.com/v4/letter/s/b9e5f3/32.png) [@shanu](https://forum.katalon.com/u/shanu)\
**Post date:** [August 29, 2019, 9:06pm UTC](https://forum.katalon.com/t/unable-to-click-a-check-box/31662/9 "2019-08-29T21:06:47Z")

</div>

My problem got resolved. By using custom keyword java script method click , I can able to click the check box.  
Thanks .

---

<div class="post-metadata">

**Author:** ![gllerena](https://avatars.discourse-cdn.com/v4/letter/g/ac8455/32.png) [@gllerena](https://forum.katalon.com/u/gllerena)\
**Post date:** [November 18, 2019, 5:17pm UTC](https://forum.katalon.com/t/unable-to-click-a-check-box/31662/10 "2019-11-18T17:17:35Z")

</div>

Can you share it?

---

<div class="post-metadata">

**Author:** ![amara89](https://avatars.discourse-cdn.com/v4/letter/a/43a26b/32.png) [@amara89](https://forum.katalon.com/u/amara89)\
**Post date:** [August 31, 2020, 2:37am UTC](https://forum.katalon.com/t/unable-to-click-a-check-box/31662/11 "2020-08-31T02:37:49Z")

</div>

@shanu : can you share the proper solution.

---

<div class="post-metadata">

**Author:** ![shanu](https://avatars.discourse-cdn.com/v4/letter/s/b9e5f3/32.png) [@shanu](https://forum.katalon.com/u/shanu)\
**Post date:** [August 31, 2020, 3:52pm UTC](https://forum.katalon.com/t/unable-to-click-a-check-box/31662/12 "2020-08-31T15:52:50Z")

</div>

Under “ **Keywords** ” section - Create a file name with commonkeywords and use the below method

public class CommonKeywords {  
/\*\*  
\* Click Web element  
\*/  
@Keyword  
def clickUsingJS(TestObject to) {  
WebDriver driver = DriverFactory.getWebDriver()  
WebElement element = WebUiCommonHelper.findWebElement(to,30)  
JavascriptExecutor executor = ((driver) as JavascriptExecutor)  
executor.executeScript(‘arguments[0].click()’, element)  
}  
}

In the testcase file, call the method like below:

CustomKeywords.‘custom\_InvestX.CommonKeywords.clickUsingJS’(findTestObject(‘Web\_Login\_Objects/Chkbox\_I\_have\_read\_the\_privacy\_policy’))

---

<div class="post-metadata">

**Author:** ![gauthamkarthik534](https://avatars.discourse-cdn.com/v4/letter/g/a587f6/32.png) [@gauthamkarthik534](https://forum.katalon.com/u/gauthamkarthik534)\
**Post date:** [October 9, 2020, 9:12pm UTC](https://forum.katalon.com/t/unable-to-click-a-check-box/31662/13 "2020-10-09T21:12:58Z")

</div>

Java script executor demo in Katalon studio

  
Check box automation in Katalon studio
