2

I'm trying to verify a value using Selenium IDE, but the value is a variable contained within a table.

In the script below, the row and column is being defined (16 is the row, 5 is the column) - but this will be impossible to maintain in future as it's constantly changing.

<tr>
    <td>verifyText</td>
    <td>//tr[@id='rgvTransactions_ctl00__16']/td[5]</td>
    <td>437.50</td>
</tr>

What's the best way to verify the value of 437.50 but without defining the exact row and column?

1 Answer 1

1

It's unclear which part will be "constantly changing". A lot of this depends on which parts of the source page will not change

If the row number will change and the row id is dynamic but has part that doesn't change, you could use the following xpath as your locator:

//tr[contains(@id,'rgvTransactions')]/td[5]

Or an alternative css locator that does the same thing:

tr[id*=rgvTransactions] > td:nth-child(5)

If the column is changing as well that is more difficult, and hard to answer without understanding more about the source of the page you are working with.

3
  • sorry, it's the row number that's changing, so [@id='rgvTransactions_ctl00__16'], the variable is 16 and changes for each test.
    – dvniel
    Commented Apr 1, 2015 at 9:06
  • also, it occurred to me that 'waitForTextPresent' looks at the entire page so the row and column doesn't have to be defined... but it's Passing the test even where the value doesn't exist which is odd. I'll try using the xpath as the locator and see if that works, thanks!
    – dvniel
    Commented Apr 1, 2015 at 9:09
  • @theonlydanever Did this help? If so, you can click the checkmark to accept this as the correct answer Commented Apr 29, 2015 at 18:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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