Mission
I am trying to fill in the username and password fields and then click the log in button to log in to Instagram using Javascript.
What I've tried (with correct login credentials):
document.querySelector('[name=username]').value = "USERNAME";
document.querySelector('[name=password]').value = "PASSWORD";
var buttons = document.getElementsByTagName('button');
for (var i = 0; i < buttons.length; i++) {
if (buttons[i].innerText == 'Log in') {
buttons[i].click();
break;
}
}
Problem
Even though the username and password fields contain a correct username and password, I get this error:
The username you entered doesn't belong to an account. Please check your username and try again.
Question
Is it possible to log in to Instagram using Javascript? If so, how can it be done?