( params: SelectorRuntimeParams, property: 'text' | 'attrs', selectorExpression: string, )
| 242 | } |
| 243 | |
| 244 | async function dispatchDirectIosSelectorGet( |
| 245 | params: SelectorRuntimeParams, |
| 246 | property: 'text' | 'attrs', |
| 247 | selectorExpression: string, |
| 248 | ): Promise<DaemonResponse | null> { |
| 249 | const session = params.sessionStore.get(params.sessionName); |
| 250 | const selector = readSimpleIosSelectorTarget({ session, selectorExpression }); |
| 251 | if (!session || !selector) return null; |
| 252 | // get text intentionally disambiguates label/text/value triplets from snapshots; the runner |
| 253 | // direct query rejects those ambiguous matches before the shared selector resolver can rank them. |
| 254 | if (property === 'text' && selector.key !== 'id') return null; |
| 255 | |
| 256 | const result = await queryDirectIosSelectorOrFallback(params, session, selector); |
| 257 | if (isDirectIosSelectorErrorResult(result)) return result.response; |
| 258 | if (!result) return null; |
| 259 | const directQuery = { session, selector, result }; |
| 260 | const payload = buildDirectIosGetResult(property, directQuery.selector.raw, directQuery.result); |
| 261 | if (!payload) return null; |
| 262 | recordIfSession( |
| 263 | params.sessionStore, |
| 264 | params.sessionName, |
| 265 | params.req, |
| 266 | buildGetRecordResult(payload, property), |
| 267 | ); |
| 268 | return { ok: true, data: toDaemonGetData(payload) }; |
| 269 | } |
| 270 | |
| 271 | async function dispatchDirectIosSelectorIs( |
| 272 | params: SelectorRuntimeParams, |
no test coverage detected