acquiescence - v0.1.7
    Preparing search index...

    Class ElementStateInspector

    Inspector for element states and interactions.

    Index

    Constructors

    Methods

    • Queries a Node for a list of states.

      Parameters

      • node: Node

        {Node} The node to query, which will be transformed into the nearest element to query the state.

      • states: ElementState[]

        {ElementState[]} The states to query.

      Returns Promise<
          | { status: "success" }
          | { status: "failure"; missingState: ElementState }
          | { status: "error"; message: string },
      >

      A Promise that resolves to an object with the status of the query.

      • 'success' if all states are present.
      • 'failure' if at least one state is missing.
      • 'error' if the node is not connected.
      • 'missingState' is the state that is missing.
      • 'message' is the message of the error.
    • Queries a Node for a single state.

      Parameters

      • node: Node

        {Node} The node to query, which will be transformed into the nearest element to query the state.

      • state: ElementStateWithoutStable

        {ElementStateWithoutStable} The state to query.

      Returns Promise<ElementStateQueryResult>

      A Promise that resolves to an object with the status of the query.

      • 'matches' is true if the state is present.
      • 'received' is the state that was received, or 'error:notconnected' if the element is not connected.

      If an invalid state is provided.

    • Checks if an element is ready for an interaction.

      Parameters

      • element: Element

        {Element} The element to check.

      • interactionType: ElementInteractionType

        {ElementInteractionType} The type of interaction to check.

      • OptionalhitPointOffset: { x: number; y: number }

        {?{x: number, y: number}} The offset of the hit point from the center of the element.

      Returns Promise<
          {
              status: ElementInteractionReadyResult;
              interactionPoint?: { x: number; y: number };
          },
      >

      A Promise that resolves to an object with the status of the check.

      • 'status' is the status of the check.
      • 'interactionPoint' is the hit point of the interaction, if the element is ready for the interaction.
      • 'needsscroll' if the element is not in the view port, and cannot be scrolled into view due to overflow.
      • 'notready' if the element is not ready for the interaction.

      If the element is

      • not connected;
      • not in the view port, and cannot be scrolled into view due to overflow
      • is obscured by another element
    • Waits for an element to be ready for an interaction.

      Parameters

      • element: Element

        {Element} The element to wait for.

      • interactionType: ElementInteractionType

        {ElementInteractionType} The type of interaction to wait for.

      • timeoutInMilliseconds: number

        {number} The timeout in milliseconds.

      • OptionalhitPointOffset: { x: number; y: number }

        {?{x: number, y: number}} The offset of the hit point from the center of the element.

      Returns Promise<{ x: number; y: number }>

      A Promise that resolves to the hit point of the interaction.

      • 'x' is the x coordinate of the hit point.
      • 'y' is the y coordinate of the hit point.

      If the element is not ready for the interaction before the timeout is reached.

    • Gets the bounding rectangle of an element in the view port.

      Parameters

      • element: Element

        {Element}The element to get the bounding rectangle of.

      Returns Promise<{ x: number; y: number; width: number; height: number } | undefined>

      A Promise that resolves to the bounding rectangle of the element in the view port, or undefined if the element is not in the view port.

      • 'x' is the x coordinate of the bounding rectangle.
      • 'y' is the y coordinate of the bounding rectangle.
      • 'width' is the width of the bounding rectangle.
      • 'height' is the height of the bounding rectangle.
      • 'undefined' if the element is not in the view port.
    • Checks if an element is in the view port.

      Parameters

      • element: Element

        {Element}The element to check.

      Returns Promise<boolean>

      A Promise that resolves to a boolean indicating if the element is in the view port.

    • Checks if an element is visible.

      Parameters

      • element: Element

        The element to check.

      Returns boolean

      A boolean indicating if the element is visible.

    • Checks if an element is disabled.

      Parameters

      • element: Element

        The element to check.

      Returns boolean

      A boolean indicating if the element is disabled.

    • Checks if an element is read only.

      Parameters

      • element: Element

        The element to check.

      Returns boolean | "error"

      A boolean indicating if the element is read only, or 'error' if the element is not an ,