Search code examples
seleniumselenium-rcselenium-ide

How do I retrieve the text in a table column using Selenium RC?


I have a table that looks like the following:

<table class="theClass">
<tr>
   <td class="anotherClass"><strong>Label1:</strong></td>
   <td colspan="3">Value1a<br/>Value1b<br/>Value1c</td>
</tr>

<tr>
   <td class="anotherClass"><strong>Label2:</strong></td>
   <td colspan="3">Value2a<br/>Value2b<br/>Value2c</td>
</tr>

<tr>
   <td class="anotherClass"><strong>Label3:</strong></td>
   <td colspan="3">Value3a<br/>Value3b<br/>Value3c</td>
</tr>
</table>

How can I use Selenium RC to retrieve Value1a, Value1b, and Value1c ? Can I use selenium.getText(...) or storeText(...)? If so, what is the proper xpath I should use? Please assume that the table cannot be changed. Thanks!


Solution

  • String value1 = selenium.getText("//tr[1]/td[1]/strong[contains(text(), Label1:')]/../../td[2]");