I have XPath, which click the element when the value matches to 1800, but I want this to work only like if the value is greater than 1800, I am noob and I don’t know about that I just googled, Here is working XPath that click on the value 1800, can anyone modify for me,
//uni-view/uni-text/span[contains(text(),"1800")]
Advertisement
Answer
If I understand your question correctly, you are looking to only select a span
that contains text >1800
Here would be a corresponding sample XML structure,
<uni-view> <uni-text> <span> 1750 </span> <span> 1800 </span> <span> 1850 </span> </uni-text> </uni-view>
You are currently using the XPath contains function which will select all span
where span/text()
contains the given string 1800
.
For the given example XML above you will only select the second span
because 1800
is contained in the span/text()
.
If you are looking to select all span
where span/text()
is ‘>1800’ you can simply remove the XPath contains function and replace it by checking if span/text() > '1800'
//uni-view/uni-text/span[text() > "1800"]
For the given example XML, this will only pull in the third span
where span/text()
is 1850
.