For AI agents: the complete documentation index is available at /next/llms.txt, the full documentation bundle is available at /next/llms-full.txt, and this page is available as Markdown at /next/api/react/testing-library/Interfaces/ByRoleOptions.md.
Lynx
  • English
    • 简体中文
  • Interface: ByRoleOptions

    Properties

    busy?

    optional busy?: boolean

    If true only includes elements in the query set that are marked as busy in the accessibility tree, i.e., aria-busy="true"


    checked?

    optional checked?: boolean

    If true only includes elements in the query set that are marked as checked in the accessibility tree, i.e., aria-checked="true"


    current?

    optional current?: string | boolean

    Filters elements by their aria-current state. true and false match aria-current="true" and aria-current="false" (as well as a missing aria-current attribute) respectively.


    description?

    optional description?: string | RegExp | ((accessibleDescription: string, element: Element) => boolean)

    Only considers elements with the specified accessible description.


    expanded?

    optional expanded?: boolean

    If true only includes elements in the query set that are marked as expanded in the accessibility tree, i.e., aria-expanded="true"


    hidden?

    optional hidden?: boolean

    If true includes elements in the query set that are usually excluded from the accessibility tree. role="none" or role="presentation" are included in either case.


    level?

    optional level?: number

    Includes elements with the "heading" role matching the indicated level, either by the semantic HTML heading elements <h1>-<h6> or matching the aria-level attribute.


    name?

    optional name?: string | RegExp | ((accessibleName: string, element: Element) => boolean)

    Only considers elements with the specified accessible name.


    pressed?

    optional pressed?: boolean

    If true only includes elements in the query set that are marked as pressed in the accessibility tree, i.e., aria-pressed="true"


    queryFallbacks?

    optional queryFallbacks?: boolean

    Includes every role used in the role attribute For example *ByRole('progressbar', {queryFallbacks: true}) will find <div role="meter progressbar">.


    selected?

    optional selected?: boolean

    If true only includes elements in the query set that are marked as selected in the accessibility tree, i.e., aria-selected="true"


    suggest?

    optional suggest?: boolean

    suppress suggestions for a specific query


    value?

    optional value?: object

    max?

    optional max?: number

    min?

    optional min?: number

    now?

    optional now?: number

    text?

    optional text?: Matcher

    Except as otherwise noted, this work is licensed under a Creative Commons Attribution 4.0 International License, and code samples are licensed under the Apache License 2.0.