hi, this is a nested HTML table. Using Xpath .//table//tr we can retrieve all table rows. That's what double forward slashes does for you (matches not only level one beaneath current node but also any sub level deeper in the hierarchy).

What I want to achieve is to be able to retrieve first-level table rows only but WITHOUT hardcoding path using single forward slash:
.//table/tr
As we can, possibly, have <tbody> tag sitting beneath <table> tag but about <tr>, in which case above xpath will miss!
(But using double forward slashes on tr will capture second level tr's which I want to exclude)

Many thanks
Code:
 
<html>
<head>Sample page</head>
     <body>
          <table>
               <tr>
                    <td>
                         <table>
                              <tr>
                                   <td>Name</td>
                                   <td>John Doe</td>
                              <tr>
                              <tr>
                                   <td>Tel</td>
                                   <td>416-987-1234</td>
                              <tr>
                         </table>
                    </td>
                    <td>
                         <table>
                              <tr>
                                   <td>EmpID</td>
                                   <td>12345</td>
                              <tr>
                              <tr>
                                   <td>Salary</td>
                                   <td>75000</td>
                              <tr>
                         </table>
                    </td>
               </tr>
               
          </table>
     </body>
</html>