Search code examples
selenium-idedescendantcolumnsorting

How to test sorting columns in Selenium IDE?


I have a table with sorting columns and I need to assert if the numbers in the columns are descending when the column has an arrow down and ascending when the column has an arrow up. I tried it this way, but receive an error when I verify the expression

<tr> //they start from an ascending order so I have to click the arrow to change it
    <td>click</td>
    <td>//div/div/div/div/table/thead/tr/th[3]</td>
    <td></td>
</tr>
<tr>
    <td>pause</td>
    <td>3000</td>
    <td></td>
</tr>
<tr>
    <td>verifyElementPresent</td>
     <td>//div/div/div/div/table/thead/tr/th[contains(@class,'sorting_desc')]/label</td>
<td></td>
</tr>
<tr>
    <td>storeText</td>
    <td>//table[@id='ecmMaskList_3_1230628']/tbody/tr/td[3]</td>
    <td>descendent</td>
</tr>
<tr>
    <td>storeEval</td>
    <td>var s = false; s = eval((storedVars['descendent']) &gt;0);</td>
     <td>s</td>
   </tr>
   <tr>
      <td>verifyExpression</td>
      <td>${s} </td>
      <td></td>
    </tr>

I tried to set S to true and got the error : [error] Actual value 'true ' did not match ''. The same when it´s on false. Does anyone know how I can store the value of the last row and then check if it´s the right one when the arrow id down? My values are dynamic, and this is why I thought it would be more flexible to just say >0, since when they are ascending they always start from 0.

Any help is much appreciated


Solution

  • Never mind, I found the solution here https://groups.google.com/forum/#!topic/selenium-users/dzQWVAyDLH4 . I just deleted my storeVal and verifyExpresion commands and replaced them with verifyVal | storedVars['descendent'] > 0. That did the trick