Bhaskar Phukan
Bhaskar Phukan

Reputation: 15

finding a span with value greater than the text using xpath in selenium

I am using selenium webdriver for automating tests.

I have a set of span elements on a webpage like this .

 <span data-template="" data-test-id="20161126092010078480788" 
 class="">8.2</span>

I want to find all the span elements which have text > 5. Can any one help me build an appropraite xpath for the same?. Note: the data-test-id attribute is same for all the spans

Upvotes: 0

Views: 1749

Answers (2)

user22269080
user22269080

Reputation: 1

<span class="a-price-whole">79,999</span>
<span class="a-price-whole">89,999</span>
<span class="a-price-whole">59,999</span>
<span class="a-price-whole">76,999</span>

xpath to find amount greater than 75000:

//*[number(translate(., ',', '')) > 75000]

output:

79999, 89999, 76999

Upvotes: -1

Andersson
Andersson

Reputation: 52675

This one should work

//span[number(.) > 5]

Upvotes: 2

Related Questions