Goal
I am determined to automate the Instagram login process using Javascript by filling in the username and password fields, then clicking the log in button.
My Attempts (with correct credentials):
Access Instagram Login Page
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;
}
}
Issue:
Despite inputting the correct username and password, an error message is displayed:
The username you entered doesn't belong to an account. Please check your username and try again.
Inquiry
Can Instagram login be automated using Javascript? If so, what is the correct approach?