Skip to content

Match elements by text content in case insensitive way #4951

@iongion

Description

@iongion

Is your feature request related to a problem? Please describe.
I'm always frustrated when I need to match elements by their text content in a case insensitive manner.

Describe the solution you'd like
A clear documented way to be able to match elements by their text value in case insensitive way.
CSS can apply text transforms and for many cases (not all) - tests can be written in clear way by avoiding to deal with casing and styling.

Describe alternatives you've considered
Tried xpath 1.0 (no working) - this

const sanitizedValue = value.replace(/'/gmi, "\\'");

//*[contains(translate(text(), 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz') , '${sanitizedValue}')]

neither this

//*[contains(translate(., 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz') , '${sanitizedValue}')]

Tried xpath 2.0 (no supported by all browser) - NO GO

Additional context
No additional context

Metadata

Metadata

Assignees

Labels

Enhancementgood first picka reasonable task to start getting familiar with the code basehelp wantedIssues that are free to take by anyone interested

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions