I am trying to write javascript function that will automatically click on first input element.
This is the website.
When I write this in Chrome console I manage to load that edit box with data.
var div_cont = document.getElementById('gwt-debug-mcc-account-page-email');
var children=div_cont.getElementsByClassName('umTb-c');
children[0].value="[email protected]";
For example:
children[0].click();
Doesn't work. Any ideas? Suggestions? Thanks
It seems you want to focus the input, rather than click it.
If that's the case, you could just use
children[0].focus();
at the console.
The thing is you won't focus the input that way, because when you call that command, the Chrome Console will be focused, not the browser viewport.
All in all, what I suggest is to run the following snippet at the console, then go back to the page (click the background, anything).
setTimeout(function() {
console.log('focusing now!');
children[0].focus();
}, 3000)
This code focus the children[0] input after 3s.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With