I am writing a chrome extension which, among other things, keeps the user logged into a web application by sending the occasional background request. But overnight all users are logged out regardless of activity.
I want to be be able to log them back in again next time they access the site. The login form is here
The form is conjured up using a js lib called handlebars so I have injected a script to access it. What I want to do is simulate a click on the “SIGN IN” button if the user has saved credentials for the site.
Testing this myself (my browser has saved credentials for the site) I can see that my email and password are automatically filled in but in a sort unconfirmed ‘grayed-out’ state. The value of the input fields are blank when I query them from the injected script. However, when I query them from the console
document.getElementById('signInName').value
I get my email address returned and the values in the fields go black. The same thing happens if I click anywhere on the document.
But simulating a click from the injected javascript does not have this effect and clicking the SIGN IN button returns a blank username / password error.
How can I confirm the auto-fill entries and submit the form from the injected javascript?