User1400794712 posted
Hi NAF,
According to the code, it seems you are using table in treeview control. Could you please share me the HTML code? Then I can understand this problem better.
Besides, you said that you were going to access the third table. The index starts from 0. So, the third table should be ('table')[2]
:
var x = document.getElementById('if1').contentWindow.document.getElementById("TreeView1").getElementsByTagName('table')[2].querySelectorAll("tbody tr td a");
You can also add 'debugger;' above 'for' loop. Then in the browser, use F12 developer tools(Open it with F12, then refresh the page) to check the value of 'x'.

Best Regards,
Daisy