class: WidgetLocator

Specialized locators for querying UMG / Slate 2D User Interfaces. Specter taps directly into the Slate Application router. Extends the base SpecterLocator.

Hierarchy & Queries

Methods for finding child widgets and extracting text.

widget.getChild

Traverses down the UMG Widget Tree to find a specific child widget by its designer name.

Usage

const acceptBtn = modal.getChild("AcceptButton", true);

Arguments

  • childNamestring
    The name of the widget in the UMG designer.
  • exactboolean(optional)
    If true, requires a perfect string match. Default: false (contains match).

widget.getText

Extracts the text from a UTextBlock or URichTextBlock.

Usage

const text = await modal.getChild("TitleText").getText();
expect(text).toBe("Are you sure?");

Returns

  • Promise<string>

widget.checkVisibility

Directly queries the Slate rendering pipeline to verify if the widget was actively drawn to the screen on the last frame.

Usage

const isVisible = await modal.checkVisibility();

Returns

  • Promise<boolean>

Input & Navigation

widget.hardwareFocus

Uses an A* spatial heuristic to automatically navigate the UI using simulated analog directional inputs (D-Pad or Joystick) until the widget achieves hardware focus.

Usage

const settingsBtn = world.widget("SettingsButton");
await settingsBtn.hardwareFocus();

Returns

  • Promise<void>

widget.click

Clicks the Slate/UMG widget. Automatically waits for the widget to be visible, enabled, and unoccluded before dispatching click events.

Usage

// Hardware Slate mouse click with custom timeout
await acceptBtn.click({ strategy: 'hardware', timeout: 8000 });

// Instant Blueprint delegate dispatch
await acceptBtn.click({ strategy: 'broadcast' });

Arguments

  • optionsObject(optional)
    • strategy'hardware' | 'broadcast'(optional)Defaults to 'hardware'
      Click dispatch strategy. 'hardware' sends real Slate cursor pointer events; 'broadcast' triggers the native Blueprint OnClicked delegate directly.
    • timeoutnumber(optional)Defaults to 5000
      Maximum time in milliseconds to wait for the widget to be actionable before throwing a timeout error.
    • contextstring(optional)
      Optional identifier to distinguish identical click commands in reports and debug logs.

Returns

  • Promise<void>

widget.hardwareAccept

Simulates pressing the standard 'Accept' button (Enter / Gamepad Face Button Bottom) natively through Slate while this widget is focused.

Usage

await acceptBtn.hardwareFocus();
await acceptBtn.hardwareAccept();

Returns

  • Promise<void>