Skip to content

Provide a "Cypress" way to access textContent (and/or innerText) - .text() command #630

Open
@verheyenkoen

Description

@verheyenkoen

Desired behavior:

Add a .text() method similar to jQuery's text method to access textContent and/or innerText.

I guess for convenience, by default cy.text() should just return whatever $(...).text() returns.

It may also be good to provide a way to get the innerText of an HTMLElement as it returns a rendered text representation (removing sub-tags and whitespace that may be part of the node, but not visible once rendered). Perhaps a flag in the .text() method or via .its('innerText') or something.

Metadata

Metadata

Assignees

No one assigned

    Labels

    pkg/driverThis is due to an issue in the packages/driver directorytype: featureNew feature that does not currently exist

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions