(locator, locateFn)
| 3234 | } |
| 3235 | |
| 3236 | async 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 | |
| 3266 | function withStrictLocator(locator) { |
| 3267 | locator = new Locator(locator) |
nothing calls this directly
no test coverage detected