I'm struggling with capybara and content I wish to validate on a website. The site is written in HTML. I'm trying to verify text in a textbox based on its label value. It's been a few hours now and I'm still stuck.. Hopefully someone can help me out!
The table structure basically looks like this:
<table>
<thead>
<tbody>
<tr>
<td class="labelColumn"><span title="Label1:">Label1:</span></td>
<td class="outputColumn"><span id="Value1:" title="Value1:">Value1</span></td>
<td class="labelColumn"><span title="Label2:">Label2:</span></td>
<td class="outputColumn"><span id="Value2:" title="Value2:">Value2</span></td>
<td class="labelColumn"><span title="Label3:">Label3:</span></td>
<td class="outputColumn"><span id="Value3:" title="Value3:">Value3</span></td>
</tr>
</tbody>
</table>
What I am trying to do is to get Value1 based on the content of Label1, get Value2 based on Label2, etc.
I've tried things like:
page.find(:css, 'tr', text: Label, :match => :first).should have_text(Value)
But that only meant it was searching within the tr as a whole, not specifically Label1 with Value1
Can someone point me in the right direction? Thanks a lot in advance!
EDIT: Should I be looking at DataTables?
| Label1 | Value1 |
| Label2 | Value2 |
| Label3 | Value3 |