If i click on a button, i want to trigger another button selected by class.
I wrote the following HTML:
<button onclick="document.getElementsByClassName("frame-16nsqo4").click()">Click</button>
If i click on a button, i want to trigger another button selected by class.
I wrote the following HTML:
<button onclick="document.getElementsByClassName("frame-16nsqo4").click()">Click</button>
As I wrote in the comment document.getElementsByClassName("frame-16nsqo4") will return an array,thus document.getElementsByClassName("frame-16nsqo4").click() will not work
you need to get the element rather than array
So change
<button onclick="document.getElementsByClassName("frame-16nsqo4").click()">Click</button>
to
<button onclick="document.getElementsByClassName("frame-16nsqo4")[0].click()">Click</button>
Document.getElementsByClassName has the suffix getElements not getElement indicating that it's a collection/array
The getElementsByClassName method of Document interface returns an array-like object of all child elements which have all of the given class name(s).
Use
document.getElementsByClassName("frame-16nsqo4")[0].click()
or better use
document.querySelector(".frame-16nsqo4").click()