A strategy for generating XPath selectors based on the tag name of an element.

Implements

Constructors

Methods

Constructors

  • Creates an instance of TagStrategy.

    Parameters

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

      An object containing a function to validate tag names.

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

            • tagName: string

            Returns boolean

    Returns TagStrategy

Methods

  • Generates a selector part for the given element if the tag name matches the criteria.

    Parameters

    • element: Element

      The DOM element for which to generate the selector part.

    Returns null | SelectorPart

    A SelectorPart object with the tag name and a penalty, or null if the tag name does not match.