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

Function findCheckable

lib/helper/WebDriver.js:3236–3264  ·  view source on GitHub ↗
(locator, locateFn)

Source from the content-addressed store, hash-verified

3234}
3235
3236async function findCheckable(locator, locateFn) {
3237 let els
3238 locator = new Locator(locator)
3239
3240 if (this._isCustomLocator(locator)) {
3241 return locateFn(locator.value)
3242 }
3243
3244 if (locator.isAccessibilityId() && !this.isWeb) return locateFn(locator, true)
3245 if (locator.isRole()) return locateFn(locator, true)
3246 if (!locator.isFuzzy()) return locateFn(locator, true)
3247
3248 const literal = xpathLocator.literal(locator.value)
3249 els = await locateFn(Locator.checkable.byText(literal))
3250 if (els.length) return els
3251
3252 // Try ARIA selector for accessible name
3253 try {
3254 els = await locateFn(`aria/${locator.value}`)
3255 if (els.length) return els
3256 } catch (e) {
3257 // ARIA selector not supported or failed
3258 }
3259
3260 els = await locateFn(Locator.checkable.byName(literal))
3261 if (els.length) return els
3262
3263 return await locateFn(locator.value) // by css or xpath
3264}
3265
3266function withStrictLocator(locator) {
3267 locator = new Locator(locator)

Callers

nothing calls this directly

Calls 4

_isCustomLocatorMethod · 0.80
isAccessibilityIdMethod · 0.80
isRoleMethod · 0.80
isFuzzyMethod · 0.80

Tested by

no test coverage detected