Take the 2-minute tour ×
Software Quality Assurance & Testing Stack Exchange is a question and answer site for software quality control experts, automation engineers, and software testers. It's 100% free, no registration required.

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:

<td class="sorting_1">78000</td>

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?

share|improve this question

1 Answer 1

up vote 4 down vote accepted

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 findElements.

share|improve this answer
    
Hey thanks for confirming this. I was thinking the same but was not sure whether that is right approach or do we have any special class in webdriver for this. It was helpful. And by the way I do have some specific class applied on sorting like asc and desc. So I will use them too. Thanks @user246. –  razizcool4all Jun 27 at 5:29
    
Yes you did, I'll update my answer. –  user246 Jun 27 at 12:51

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.