javascriptgoogle-chromefirefoxweb-consolebrowser-console

Can a browser's dev console continue executing JavaSript after a new page loads?


I'm trying to automate some online work through JavaScript and the Firefox (or Chrome) dev console. The work is mostly inputting the same (or similar) data on the same exact pages for many many people.

Example:

I wrote a very simple script that runs in the console and enters the data just fine.

The Problem

My script stops execution whenever it requires the page to reload or it loads another page. I cannot find any information on how to continue executing a script after a page has loaded.

My Limitations

I'm basically limited to what's on FireFox, Chrome, or Edge. Unfortunately, I cannot download any programs or tools that would make the automation any easier right now. Otherwise, I would just use Selenium and Python.

What I've Tried

First I tried to use the script that I describe above (simple DOM manipulation)

Then I tried to use the Selenium browser add-on, but I had to enter a starting URL for it to run. Selenium was not able to get past the login page of our system which is the only static URL that I can use as a starting point.

I then tried to use the Firefox Browser Console (different from the dev console) because the documentation seemed to suggest that I can use JavaScript on the entire browser (not just one tab). Unfortunately, I cannot find any helpful information on how to use the browser console for DOM manipulation. Everything that I search for points to how you create a browser extension, add-on, or how to use JavaScript on your own website.

What I Want To Do

I want to create a script that runs in a dev console. The script should take all of the data either from a separate page or an array then enter the data on each page for each person. I'll also have it prompt the user to verify the data before submission.

What I'm Looking For

What I'm hoping to get from this question is at least one three things.

  1. An answer to the question's title.
  2. Being directed to documentation or some other solution that can solve any of the above problems.
  3. Being told if this is impossible and why by those who have more experience than me (I don't understand if the problem is just a lack of knowledge or limitations on the tools themselves.)

Solution

  • I think you can create a chrome extension and put your code in the background service worker. or use workers read this link