Reputation: 1
I have a page on the UI where the data looks like this
name1 label1 name2 label2 name3 label3 name4 label4 name5 label5 name6 label6
If i have to look for name3 and also verify that label3 is adjacent to it? how would I do it? the names have no id and name associated with them. checked in firebug.
the fir bug shows something like this:
<table class="content-grid" width="95%" cellspacing="0" cellpadding="2">
<tbody>
<tr>
<tr class="content-grid-stripe-light">
<td>name1 </td>
<td>
</tr>
<tr class="content-grid-stripe-dark">
</table>
Can someone please suggest.
Upvotes: 0
Views: 517
Reputation: 928
If you are using selenium WebDriver, you can follow those steps:
use tableRows = driver.findElements(By.xpath("//tr/td"))
to put in tablerows
all your td
elements
fetch your tablerows and make a comapare between tableRows[i]
and tableRows[i+1]
, for example if(tableRows.get(i).getText()).equals((tableRows.get(i+1).getText())) then .........
Use something like that, I hope that this will be useful to you
Upvotes: 1