Playwright Page instance (or any structural equivalent).
Optional filtering and timeout options.
AiResponse<PageContext> — 'success' with a full snapshot or
'error' with a recoverable error payload.
Calls sap.ui.core.ElementRegistry.all() (UI5 ≥ 1.106) in the browser,
falling back to sap.ui.getCore().mElements for older runtimes. Each
discovered control is classified by interactivity, container membership, and
object category. The result is partitioned into buttons, formFields,
tables, and navigationElements for convenient AI consumption.
The browser-side script is serialized via fn.toString() — module-level
imports are not available in the browser callback.
import { discoverPage } from '#ai/bulk-discovery.js';
// Basic usage
const response = await discoverPage(page, { interactiveOnly: true });
if (response.status === 'success') {
logger.info(`${response.data.controls.length} controls found`);
}
// With pagination
const paged = await discoverPage(page, { limit: 20, offset: 40 });
Discovers all UI5 controls on the current Playwright page.