Ihor Harmatii
Ihor Harmatii

Reputation: 300

Find element by xpath using only first part of attribute value

I have few elements which have in common only first part of attribute value, my question is, is that possibly to find list of elements by only partial value

below are elements:

<div data-fields="productLIFiveYr" style="overflow: hidden;">…</div>
<div data-fields="productLITenYr" style="overflow: hidden;">…</div>
<div data-fields="productLITwentyYr" style="overflow: hidden;">…</div>

and I am looking for something like this: xpath='//div[data-fields="product.."]'

Upvotes: 0

Views: 98

Answers (1)

k5_
k5_

Reputation: 5558

//div[starts-with(@data-fields, "product")]

Upvotes: 3

Related Questions