Reputation: 538
Hi I have a html page like below:
<tr>
<td class = "sdfgg" >
<nobr> 3000 </nobr>
</td>
<td class = "retre" >
<nobr> Comm error </nobr>
</td>
</tr>
<tr>
<td class ="fdhdf" >
<nobr> Time: </nobr>
</td>
<td class ="csfds" >
<nobr> 10:00PM </nobr>
</td>
<td class ="hdfh" >
<nobr> Data code: </nobr>
</td>
<td class ="dfhfd" >
<nobr> 456 </nobr>
</td>
</tr>
I need to find all other elements using element "3000" which is event id. I find this element as follows:
$"//nobr[text()='{eventId}']"
which is nothing but $"//nobr[text()='3000']"
I can also find Comm error by using event id in xpath as below:
$"//td/nobr[text()='{eventID}']/parent::td/following-sibling::td/nobr"
How do I find remaining elements using the same event id?. Could someone please help? Other elements to find using '3000' are: "Time", "10:00 PM" , "Data code", "456" The page being dynamic i cannot use class attribute.
Upvotes: 0
Views: 140
Reputation: 5347
The following x-paths may help you.
To find the element comm error
//td/nobr[normalize-space(text())='3000']/parent::td/following-sibling::td/nobr
To find other elements
//td/nobr[normalize-space(text())='3000']/../../following-sibling::tr[1]/td/nobr
Upvotes: 1