ClassStrategy is responsible for generating XPath selectors based on the class attribute of an element.

Implements

Constructors

Methods

Constructors

  • Creates an instance of ClassStrategy.

    Parameters

    • options: {
          className: ((className: string) => boolean);
      }

      An object containing a function to filter class names.

      • className: ((className: string) => boolean)
          • (className): boolean
          • Parameters

            • className: string

            Returns boolean

    Returns ClassStrategy

Methods

  • Generates an XPath selector part for the given element based on its class attribute.

    Parameters

    • element: Element

      The DOM element for which to generate the selector.

    Returns null | SelectorPart

    A SelectorPart object containing the XPath selector and its penalty, or null if no valid class is found.