how to check check box and getting whether checkbox is checked in javascript selenium and node. I tried using .click on the element also tried using native javascript code to do that.but nothing worked for me.

   element.click().then(function(){//body goes here


I have edited the code in SO itself so there might be braces problem.in actual code its not the braces problem.

any solutions to do so?

2 Answers 2


if you want to use JS - use .checked to get if checkbox is checked

Like in this example:

return document.getElementsByName('element_name')[0].checked;

If you want to know whether element was selected with Selenium use .isSelected()


You can try getting attribute "checked". If your checkbox is selected, it will return true or it will return false or null.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.