| 3181 | } |
| 3182 | |
| 3183 | async function findCheckable(locator, context) { |
| 3184 | let contextEl = await this.context |
| 3185 | if (typeof context === 'string') { |
| 3186 | contextEl = await findElements.call(this, contextEl, new Locator(context, 'css').simplify()) |
| 3187 | contextEl = contextEl[0] |
| 3188 | } |
| 3189 | |
| 3190 | const matchedLocator = new Locator(locator) |
| 3191 | if (!matchedLocator.isFuzzy()) { |
| 3192 | return findElements.call(this, contextEl, matchedLocator) |
| 3193 | } |
| 3194 | |
| 3195 | const literal = xpathLocator.literal(matchedLocator.value) |
| 3196 | let els = await findElements.call(this, contextEl, Locator.checkable.byText(literal)) |
| 3197 | if (els.length) { |
| 3198 | return els |
| 3199 | } |
| 3200 | els = await findElements.call(this, contextEl, Locator.checkable.byName(literal)) |
| 3201 | if (els.length) { |
| 3202 | return els |
| 3203 | } |
| 3204 | |
| 3205 | // Try ARIA selector for accessible name |
| 3206 | try { |
| 3207 | els = await contextEl.$$(`::-p-aria(${matchedLocator.value})`) |
| 3208 | if (els.length) return els |
| 3209 | } catch (err) { |
| 3210 | // ARIA selector not supported or failed |
| 3211 | } |
| 3212 | |
| 3213 | return findElements.call(this, contextEl, matchedLocator.value) |
| 3214 | } |
| 3215 | |
| 3216 | async function proceedIsChecked(assertType, option) { |
| 3217 | let els = await findCheckable.call(this, option) |