MCPcopy Index your code
hub / github.com/codeceptjs/CodeceptJS / grabCheckedElementStatus

Method grabCheckedElementStatus

lib/helper/Playwright.js:1558–1567  ·  view source on GitHub ↗

* Return the checked status of given element. * * @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator. * @param {object} [options] See https://playwright.dev/docs/api/class-locator#locator-is-checked * @return {Promise } *

(locator, options = {})

Source from the content-addressed store, hash-verified

1556 */
1557
1558 async grabCheckedElementStatus(locator, options = {}) {
1559 const supportedTypes = ['checkbox', 'radio']
1560 const el = await this._locateElement(locator)
1561 const type = await el.getAttribute('type')
1562
1563 if (supportedTypes.includes(type)) {
1564 return el.isChecked(options)
1565 }
1566 throw new Error(`Element is not a ${supportedTypes.join(' or ')} input`)
1567 }
1568 /**
1569 * Return the disabled status of given element.
1570 *

Callers 1

Playwright_test.jsFile · 0.80

Calls 3

_locateElementMethod · 0.95
getAttributeMethod · 0.80
includesMethod · 0.80

Tested by

no test coverage detected