It is necessary to click on the next one by reference, I try so

window.content.document.getElementsByClassName('u А')[0].click(); 

But something does not click it. Here is all the HTML code.

 <td class="u"><a href="/test">1</a></td><td class="o"></td> <td class="u"><a href="/test">1</a></td><td class="o"></td> <td class="u"><a href="/test">1</a></td><td class="o"></td> <td class="u"><a href="/test">1</a></td><td class="o"></td> <td class="u"><a href="/test">1</a></td><td class="o"></td> 

Tell me how to make a click on the link, but I can do the selection myself.

1 answer 1

First you need document.getElementsByClassName("u") . Secondly, when you click on the link, pop-up pops up (pop-up window), and it can only be triggered by the actions of the user. If you need to click on the link without opening the popup, then everything works for you except the selector at the beginning.

  • First you need document.getElementsByClassName ("u"). FirstChild - you tried to use the code. who advise? getElementsByClassName returns the collection, this collection does not have the firstChild field / property, so document.getElementsByClassName("u").firstChild will always return undefined - Grundy