Appearance
Function: findElement()
ts
function findElement(
ctx: Context,
rootSelector: string,
targetSelector: string): Promise<ElementHandle<Element> | null>;Defined in: src/pages/index.ts:287
Search for an element inside nested shadow roots.
Parameters
| Parameter | Type | Description |
|---|---|---|
ctx | Context | The current Context. |
rootSelector | string | Selector for the root element to start the search from. |
targetSelector | string | Selector for the target element within shadow DOM trees. |
Returns
Promise<ElementHandle<Element> | null>
The matching ElementHandle, or null if not found.
Example
ts
// Find an input buried inside a Salesforce Lightning component.
const emailInput = await findElement(ctx, 'lightning-record-form', 'input#email');
await clickOnElementHandle(emailInput);