# Check Checkbox error

**URL:** <https://forum.robotframework.org/t/check-checkbox-error/803>\
**Category:** Browser\
**Created:** [6 October 2020 15:30 UTC](https://forum.robotframework.org/t/check-checkbox-error/803 "2020-10-06T15:30:10Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jakob.vollmer](https://avatars.discourse-cdn.com/v4/letter/j/5daacb/32.png) [@jakob.vollmer](https://forum.robotframework.org/u/jakob.vollmer)\
**Post date:** [6 October 2020 15:30 UTC](https://forum.robotframework.org/t/check-checkbox-error/803/1 "2020-10-06T15:30:10Z")

</div>

Hello Everybody  
I have a problem with the Check Checkbox/Uncheck Checkbox keyword. The error I get is as follows:

```python
Error: elementHandle.check: Evaluation failed: Error: Not a checkbox
    at InjectedScript.isCheckboxChecked ( __playwright_evaluation_script__ 2:1057:15)
    at eval ( __playwright_evaluation_script__ 36:1:33)
    at UtilityScript.callFunction ( __playwright_evaluation_script__ 3:305:24)
    at UtilityScript.<anonymous> ( __playwright_evaluation_script__ 37:1:44)
Note: use DEBUG=pw:api environment variable and rerun to capture Playwright logs.

```

I use The Browser library and that is my code:

```python
${FMD_put} Get Element xpath=/html/body/div[2]/div/div[3]/div[3]/div/settings-page >> css=app-frame >> xpath=davinci-tabs/davinci-tab[1]/application-settings >> css=div >> xpath=mcrs-collapse[2]/p[2]/div/span[1]/davinci-checkbox
    
Sleep 1s    
Check Checkbox ${FMD_put}

```

However I am surprised that the get checkbox state keyword ist working fine.  
I would be very happy about any help or advice 😉

Jakob Vollmer

---

<div class="post-metadata">

**Author:** ![René](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/ren%C3%A9/32/7_2.png) [@René](https://forum.robotframework.org/u/Ren%C3%A9)\
**Post date:** [7 October 2020 21:10 UTC](https://forum.robotframework.org/t/check-checkbox-error/803/2 "2020-10-07T21:10:11Z")

</div>

`davinci-checkbox`

Does really not sound like a checkbox.  
Checkboxes are `<input type="checkbox">` elements with the attribute type set to checkbox.

Try to use just click on that element.

Ps: why does your selector look like it looks like?  
This switching between xpath and css…  
Do you have shadowdoms?  
I would strongly recommend to avoid these `//div[2]` thinks. The numbers in xpath. They are evil. Hige rosk of future maintenance issues.

---

<div class="post-metadata">

**Author:** ![jakob.vollmer](https://avatars.discourse-cdn.com/v4/letter/j/5daacb/32.png) [@jakob.vollmer](https://forum.robotframework.org/u/jakob.vollmer)\
**Post date:** [8 October 2020 08:52 UTC](https://forum.robotframework.org/t/check-checkbox-error/803/3 "2020-10-08T08:52:23Z")

</div>

Hi Rene  
Thanks for your tip. With the click keyword it works fine. But I am still a bit surprised that the Get Checkbox State Keyword is doing fine on the same Element … 😉  
Yes I have shadowdoms therefore I switch between css and xpath. But I have no other idea how to reach the elements, since none of the elements has a unique ID. Do you have any idea how to do that?

---

<div class="post-metadata">

**Author:** ![René](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/ren%C3%A9/32/7_2.png) [@René](https://forum.robotframework.org/u/Ren%C3%A9)\
**Post date:** [9 October 2020 15:39 UTC](https://forum.robotframework.org/t/check-checkbox-error/803/4 "2020-10-09T15:39:46Z")

</div>

> [@jakob.vollmer](#):
>
> But I have no other idea how to reach the elements, since none of the elements has a unique ID. Do you have any idea how to do that?

No general one. do not just copy xpath. Try to understand what makes an element unique within one shadowdom.

I would generally prefer css over xpath. typically i would use css for element selection and xpath only if i have to go up the tree and text sometimes.

```javascript
Click //settings-page >> app-frame >> //application-settings >> "Settings" >> ../.. >> mcrs-collapse >> davinci-checkbox

```

[https://marketsquare.github.io/robotframework-browser/Browser.html#Finding%20elements](https://marketsquare.github.io/robotframework-browser/Browser.html#Finding%20elements)
