Function highlightXpath

  • Creates a visible highlight around an element by XPath selector.

    Parameters

    • ctx: Context

      Context object.

    • selector: string

      An XPath selector pointing to the element to overlay with a highlight.

    • Optional options: HighlightSelectorOptions

      Options for the highlight.

    Returns Watcher<ElementHandle<Node>>

    The Watcher instance observing the lifecycle of the element.

    Remarks

    A highlight is a colored transparent marker that appears around an element. It point users to important data or fields that they should acknowledge, double-check, confirm, or edit. Highlights do not block clicks or other user actions.

    The highlight will be applied and removed depending on element existence, and it survives navigation. Optionally, pass ensureVisible to apply the highlight only to visible elements. The highlight is appended to the element's scroll container and will follow scrolling and display with the correct z-index.

    The highlight will be started automaticaly, and it can be removed from the DOM by calling stop().

    Example

    const highlights = [
    highlightXpath(ctx, '//div[@class="mySelector"]'),
    highlightXpath(ctx, '//div[@class="myOtherSelector"]'),
    ];
    // ...
    for (let h of highlights) h.stop();

Generated using TypeDoc