HTMLvariable

Use this InteractorConstructor as a base for creating interactors which work with HTML elements. This provides some basic functionality which is convenient for most HTML elements.

Example

const Link = HTML.extend<HTMLLinkElement>('link')
  .selector('a[href]')
  .filters({
    href: (element) => element.href
  })

Filters

  • classList: string[] — Filter by the list of classes found in element's className
  • className: string — Filter by element's className
  • title: string – Filter by title
  • id: string – Filter by id
  • text: string – Filter by the text content of this element.
  • visible: boolean – Filter by visibility. Defaults to true. See isVisible.
  • focused: boolean – Filter by whether the element is focused. See focused.

Actions

  • click(): Interaction – Click on the element
  • focus(): Interaction – Move focus to the element
  • blur(): Interaction – Move focus away from the element

← Back to @interactors/html