document.getElementById('foo').click();
This does the trick.
Give it id instead of class and you will be able to do it.
If you can’t give it an ID and need to use the class this will do:
var foo = document.getElementsByClassName('foo');
foo[0].click();
12
solved How I can push that button in browser console?