Variable domConst

dom: {
    click: ((element: Element) => void);
    event: ((args: {
        element?: Element | Window & typeof globalThis | HTMLElement;
        event: string | Event;
    }) => void);
    getComputedStyle: ((element: Element | HTMLElement) => CSSStyleDeclaration);
    isElementVisible: ((element: Element, previousElement?: Element) => boolean);
    qs: {
        <K>(selectors: K): null | HTMLElementTagNameMap[K];
        <K>(selectors: K): null | SVGElementTagNameMap[K];
        <K>(selectors: K): null | MathMLElementTagNameMap[K];
        <K>(selectors: K): null | HTMLElementDeprecatedTagNameMap[K];
        <E>(selectors: string): null | E;
    };
    qsa: {
        <K>(selectors: K): NodeListOf<HTMLElementTagNameMap[K]>;
        <K>(selectors: K): NodeListOf<SVGElementTagNameMap[K]>;
        <K>(selectors: K): NodeListOf<MathMLElementTagNameMap[K]>;
        <K>(selectors: K): NodeListOf<HTMLElementDeprecatedTagNameMap[K]>;
        <E>(selectors: string): NodeListOf<E>;
    };
    sleep: ((ms: number) => Promise<void>);
    waitFor: ((args: string | {
        selector?: string;
        timeout?: number;
        visible?: boolean;
    }, lambda?: (() => null | Element)) => Promise<Element | null>);
    waitForText: ((args: {
        element: Element;
        multipleTags?: boolean;
        regex?: RegExp;
        text?: string;
        timeout?: number;
    }) => Promise<Element | null>);
} = ...

Type declaration

  • click: ((element: Element) => void)
      • (element): void
      • Click the given element.

        Parameters

        • element: Element

        Returns void

  • event: ((args: {
        element?: Element | Window & typeof globalThis | HTMLElement;
        event: string | Event;
    }) => void)
      • (args): void
      • Dispatch an event from the given element.

        Parameters

        • args: {
              element?: Element | Window & typeof globalThis | HTMLElement;
              event: string | Event;
          }
          • Optionalelement?: Element | Window & typeof globalThis | HTMLElement
          • event: string | Event

        Returns void

  • getComputedStyle: ((element: Element | HTMLElement) => CSSStyleDeclaration)
  • isElementVisible: ((element: Element, previousElement?: Element) => boolean)
  • qs: {
        <K>(selectors: K): null | HTMLElementTagNameMap[K];
        <K>(selectors: K): null | SVGElementTagNameMap[K];
        <K>(selectors: K): null | MathMLElementTagNameMap[K];
        <K>(selectors: K): null | HTMLElementDeprecatedTagNameMap[K];
        <E>(selectors: string): null | E;
    }
      • <K>(selectors): null | HTMLElementTagNameMap[K]
      • Returns the first element that is a descendant of node that matches selectors.

        MDN Reference

        Type Parameters

        • K extends keyof HTMLElementTagNameMap

        Parameters

        • selectors: K

        Returns null | HTMLElementTagNameMap[K]

      • <K>(selectors): null | SVGElementTagNameMap[K]
      • Type Parameters

        • K extends keyof SVGElementTagNameMap

        Parameters

        • selectors: K

        Returns null | SVGElementTagNameMap[K]

      • <K>(selectors): null | MathMLElementTagNameMap[K]
      • Type Parameters

        • K extends keyof MathMLElementTagNameMap

        Parameters

        • selectors: K

        Returns null | MathMLElementTagNameMap[K]

      • <K>(selectors): null | HTMLElementDeprecatedTagNameMap[K]
      • Type Parameters

        • K extends keyof HTMLElementDeprecatedTagNameMap

        Parameters

        • selectors: K

        Returns null | HTMLElementDeprecatedTagNameMap[K]

      • <E>(selectors): null | E
      • Type Parameters

        • E extends Element = Element

        Parameters

        • selectors: string

        Returns null | E

  • qsa: {
        <K>(selectors: K): NodeListOf<HTMLElementTagNameMap[K]>;
        <K>(selectors: K): NodeListOf<SVGElementTagNameMap[K]>;
        <K>(selectors: K): NodeListOf<MathMLElementTagNameMap[K]>;
        <K>(selectors: K): NodeListOf<HTMLElementDeprecatedTagNameMap[K]>;
        <E>(selectors: string): NodeListOf<E>;
    }
      • <K>(selectors): NodeListOf<HTMLElementTagNameMap[K]>
      • Returns all element descendants of node that match selectors.

        MDN Reference

        Type Parameters

        • K extends keyof HTMLElementTagNameMap

        Parameters

        • selectors: K

        Returns NodeListOf<HTMLElementTagNameMap[K]>

      • <K>(selectors): NodeListOf<SVGElementTagNameMap[K]>
      • Type Parameters

        • K extends keyof SVGElementTagNameMap

        Parameters

        • selectors: K

        Returns NodeListOf<SVGElementTagNameMap[K]>

      • <K>(selectors): NodeListOf<MathMLElementTagNameMap[K]>
      • Type Parameters

        • K extends keyof MathMLElementTagNameMap

        Parameters

        • selectors: K

        Returns NodeListOf<MathMLElementTagNameMap[K]>

      • <K>(selectors): NodeListOf<HTMLElementDeprecatedTagNameMap[K]>
      • Type Parameters

        • K extends keyof HTMLElementDeprecatedTagNameMap

        Parameters

        • selectors: K

        Returns NodeListOf<HTMLElementDeprecatedTagNameMap[K]>

      • <E>(selectors): NodeListOf<E>
      • Type Parameters

        • E extends Element = Element

        Parameters

        • selectors: string

        Returns NodeListOf<E>

  • sleep: ((ms: number) => Promise<void>)
      • (ms): Promise<void>
      • Sleeps for ms milliseconds.

        Parameters

        • ms: number

        Returns Promise<void>

  • waitFor: ((args: string | {
        selector?: string;
        timeout?: number;
        visible?: boolean;
    }, lambda?: (() => null | Element)) => Promise<Element | null>)
      • (args, lambda?): Promise<Element | null>
      • Find an element

        Parameters

        • args: string | {
              selector?: string;
              timeout?: number;
              visible?: boolean;
          }
        • Optionallambda: (() => null | Element)

          [lambda]

            • (): null | Element
            • Returns null | Element

        Returns Promise<Element | null>

        The HTML element

        • Throws an error if neither lambda nor selector is provided.
        • Throws an error if the element is not found within the timeout.
  • waitForText: ((args: {
        element: Element;
        multipleTags?: boolean;
        regex?: RegExp;
        text?: string;
        timeout?: number;
    }) => Promise<Element | null>)
      • (args): Promise<Element | null>
      • Look for the given text within the given parent element. Return the element containing the text.

        Parameters

        • args: {
              element: Element;
              multipleTags?: boolean;
              regex?: RegExp;
              text?: string;
              timeout?: number;
          }
          • element: Element
          • OptionalmultipleTags?: boolean
          • Optionalregex?: RegExp
          • Optionaltext?: string
          • Optionaltimeout?: number

        Returns Promise<Element | null>