<table class="xju" id="pt1:_d_reg:region2:1:dtrt_dc_4333407150" cellpadding="0" cellspacing="0" border="0" summary="" currentxpathtry="15">
<tbody>
<tr>
<td class="x15" currentmouseover="254">
<label class="af_panelLabelAndMessage_label-text" currentmouseover="471">Location Name</label>
</td>
<td valign="top" class="xwv xjv" currentmouseover="382">AP51</td>
</tr>
</tbody>
</table>
In the above XML, i need to fetch the id attribute value of table tag. There are n number of table tags available and only unique value text value of label tag. P.S: table tag is not the root tag
driver.getWebDriver().findElement(By.xpath("//table[tbody/tr/td/label = 'Location Name']")).getAttribute("id");
Instead of using tbody/tr/td/label = 'Location Name', is there is way to relatively filter based on conditon value 'Location Code'