Will check, by clicking, on a checkbox or radio input if it is not already checked.
The element is scrolled into view if it is not already pointer-interactable. See the WebDriver specification for element interactability.

For more info on working with DOM elements in Nightwatch, refer to the Finding & interacting with DOM Elements guide page.

Usage

                    browser.element(selector).check()
                

Example

export default {
  demoTest(browser: NightwatchAPI): void {
    browser.element('input[type=checkbox]:not(:checked)').check();
    browser.element('input[type=radio]:not(:checked)').check();
  },
  async demoTestAsync(browser: NightwatchAPI): Promise<void> {
    await browser.element('input[type=checkbox]:not(:checked)').check();
    await browser.element('input[type=radio]:not(:checked)').check();
  },
}

Returns

Type description
ScopedWebElement