I am trying to create an extension that will log me into a website as soon as it detects that I'm not logged in - ignore the fact that my background.js
does not do this now, it's not the problem. - The website I am trying to log in to has my username and password already filled in the fields through my Chrome passwords. All the script has to do is click the login button.
Essentially it seems to work, except for the fact that it doesn't log in. Whenever the script tries to log in I get the message that my username/password is incorrect. When I execute the script through the console instead of injecting it through my background.js, it works perfectly.
background.js
chrome.tabs.onUpdated.addListener(function(id, info, tab){
if (tab.status !== "complete"){
return;
}
chrome.tabs.executeScript(null, {"file": "login.js"});
});
login.js (the form id is loginForm
)
document.getElementById("loginForm").submit();
Any and all help is appreciated. Thanks!