glamredhel
glamredhel

Reputation: 336

How to use wildcard attribute name and contains()?

In my problem I search for elements that have an example structure like:

<ngc-product-card ng-reflect-signup-type="comprehensive">

Since the elements may have the comprehensive value stored in another attribute, say:

<new-ngc-product-card data-label="comprehensive signup">

hence I would like to use a wildcard-attribute-name search and also apply the contains() function like:

//*[contains(@*,"comprehensive")]

which doesn't work What does work is

//*[@*="comprehensive"]

Is there any way to use both '@*' and 'contains()' ?

Upvotes: 0

Views: 141

Answers (1)

josephting
josephting

Reputation: 2665

This should do.

//*[@*[contains(., "comprehensive")]]

Upvotes: 3

Related Questions