Check Checkbox error

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

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:

${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 :wink:

Jakob Vollmer

1 Like


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.

1 Like

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 … :wink:
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?

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.

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