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

Method checkOption

lib/helper/WebDriver.js:1384–1399  ·  view source on GitHub ↗

* Appium: not tested * {{> checkOption }}

(field, context = null)

Source from the content-addressed store, hash-verified

1382 * {{> checkOption }}
1383 */
1384 async checkOption(field, context = null) {
1385 const clickMethod = this.browser.isMobile && this.browser.capabilities.platformName !== 'android' ? 'touchClick' : 'elementClick'
1386 const locateFn = prepareLocateFn.call(this, context)
1387
1388 const res = await findCheckable.call(this, field, locateFn)
1389
1390 assertElementExists(res, field, 'Checkable')
1391 const elem = selectElement(res, field, this)
1392 const elementId = getElementId(elem)
1393 highlightActiveElement.call(this, elem)
1394
1395 const isSelected = await isElementChecked(this.browser, elementId)
1396
1397 if (isSelected) return Promise.resolve(true)
1398 return this.browser[clickMethod](elementId)
1399 }
1400
1401 /**
1402 * Appium: not tested

Callers

nothing calls this directly

Calls 4

selectElementFunction · 0.90
getElementIdFunction · 0.85
isElementCheckedFunction · 0.85
assertElementExistsFunction · 0.70

Tested by

no test coverage detected