MCPcopy
hub / github.com/codeceptjs/CodeceptJS / checkOption

Method checkOption

lib/helper/Puppeteer.js:1465–1481  ·  view source on GitHub ↗

* {{> checkOption }}

(field, context = null)

Source from the content-addressed store, hash-verified

1463 * {{> checkOption }}
1464 */
1465 async checkOption(field, context = null) {
1466 const elm = await this._locateCheckable(field, context)
1467 let curentlyChecked = await elm
1468 .getProperty('checked')
1469 .then(checkedProperty => checkedProperty.jsonValue())
1470 .catch(() => null)
1471
1472 if (!curentlyChecked) {
1473 const ariaChecked = await elm.evaluate(el => el.getAttribute('aria-checked'))
1474 curentlyChecked = ariaChecked === 'true'
1475 }
1476
1477 if (!curentlyChecked) {
1478 await elm.click()
1479 return this._waitForAction()
1480 }
1481 }
1482
1483 /**
1484 * {{> uncheckOption }}

Callers

nothing calls this directly

Calls 6

_locateCheckableMethod · 0.95
_waitForActionMethod · 0.95
getPropertyMethod · 0.80
evaluateMethod · 0.80
getAttributeMethod · 0.80
clickMethod · 0.45

Tested by

no test coverage detected