Nightwatch.js: Check if a checkbox is checked

This test involves waiting for a checkbox to be visible, clicking on the checkbox, and then verifying that the checkbox has been checked.

The checkbox has the following HTML DOM:

<input type="checkbox" name="vote">

Here is the Nightwatch.js test:

.verify.visible('input[name="vote"]', 'The checkbox named vote is visible')
 .waitForElementVisible('body', 1000)
 .element('name', 'vote', function(response) {
 client.elementIdSelected(response.value.ELEMENT, function(result) {
 client.verify.ok(result.value, 'Checkbox is selected');

Leave a Reply

Your email address will not be published. Required fields are marked *