I am currently injecting a Javascript file into a webpage from a chrome extension in order to auto-fill and submit a form on the webpage. Furthermore, I need this script to continuously auto-fill and execute the script. However, the form submission only will occur at the end of the script, forcing me to run the entire script multiple times rather than use a loop on the script's content. How can I go about ruing the same Javascript file over and over on a webpage? The method I am currently doing seems to fail and runs the script only once.
Here is my current background.js:
// listen for our browerAction to be clicked
chrome.browserAction.onClicked.addListener(function (tab) {
executeScripts(null, [
{ file: "inject.js" },
{ file: "inject.js" },
{ file: "inject.js" },
{ code: "inject.js" }
])
});
Inject.js is the Javascript file that I want to run multiple times. Here is the simplified version of the script:
(function() {
var text = "hello";
var url = "www.google.com"
document.getElementById('personaName').value = text;
document.getElementById('customURL').value = url;
var form = document.getElementById("editForm");
form.submit();
})();
