'Userscript/Tampermonkey click button with no id [duplicate]

I am extremely new so please explain as simply as possible to me. I'm trying to press a button that pops up as confirmation automatically, but it has no ID and so I can't figure out how. The buttons html is <input type="button" class="beigebutton thingbutton dialog-submit" value="Okay">

I've tried document.querySelector('#button').click() with button being replaced by everything I can find, as well as const inputElement = document.querySelector('input[value="Okay"]'); inputElement.click();

I've also tried document.querySelector("#archaeology-dialog > div > input") but nothing seems to actually work. I appreciate any help given, I'm very new and this has me stumped.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source