Onclick of <button>
Я бы заполнил значение поля ввода и непосредственно отправил его. Поле ввода выглядит так:
<input aria-label="Ask me something..." autocomplete="off"
placeholder="Ask me something..." autofocus="autofocus" type="text"
class="queryform">
Я пробовал что-то подобное, но не могу отправить его:
document.getElementsByClassName("queryform")[0].value='Hallo Joris'
var e = new Event("keyup");
e.key='Enter';
e.keyCode=e.key.charCodeAt(13);
e.which=e.keyCode;
e.altKey=false;
e.ctrlKey=true;
e.shiftKey=false;
e.metaKey=false;
e.bubbles=true;
document.getElementsByClassName("queryform")[0].dispatchEvent(e);
Вы можете поиграть на gowogo.com