How to compare value of a td of a table with a numeric value using webdriver?
I have to compare a value of a td tag with a numeric value. I have o check whether the value coming in that td is >= some value. The html of td is:
I want to compare that the value 78000 >=75000. Basically there is a sorting method on th. So I have to test the sorting process, So I thought to sort in ascending and comparing the first value with the boundary value and again sorting in desc and doing same comparison.
How to do this in webdriver?
You can use the findElements method to find all TD tags that match your criteria, and then getText method to retrieve each element's value. The latter will be returned as a String, so you may need to convert it to a number before comparing it.
Since the sorted elements have a special class, you may want to use a CSS selector with