Home > widget-integration > InstantSearchSelectors > waitForISWElement

InstantSearchSelectors.waitForISWElement() method

Wait for the ISW root element (#bc-instant-search) to appear in the DOM.

Uses a MutationObserver on document.body so the caller can await the element even if it is injected asynchronously by the template renderer.

**Legacy**: waitForInstantSearchElement() standalone function **New**: Instance method on selectors service

Signature:

waitForISWElement(timeout?: number): Promise<HTMLElement | null>;

Parameters

Parameter

Type

Description

timeout

number

(Optional) Maximum wait time in ms (default 10 000). Pass 0 to wait indefinitely.

Returns:

Promise<HTMLElement | null>

The ISW root element, or null if the timeout is reached