AutomaApp / automa

A browser extension for automating your browser by connecting blocks
https://www.automa.site
Other
11.33k stars 1.21k forks source link

Already selected the 'Run before page loaded' option, but I still need to wait for the browser resources to load, which ultimately caused JavaScript execution to timeout #1796

Open ZhangWei55kai opened 1 month ago

ZhangWei55kai commented 1 month ago

Describe the bug A clear and concise description of what the bug is.

image image image

My goal is simple. I hope to execute the JavaScript I have pre-set in the browser before opening the page. However, the current situation is that I have to wait for the page to load before executing the custom JavaScript, which takes a very long time and does not meet my expectations

jingbof commented 2 weeks ago

The reason your script always waits for the page to fully load is because you're using window.onload. You can check out more details here: MDN: Window Load Event. Basically, the window.load event fires after the whole page, including all the styles, scripts, images, etc., has loaded.

So while you're telling the extension to run the code before the page loads, your script is actually telling Chrome to hold off until everything's fully loaded. LOL

Just move everything out of window.onload = function() {} and it should work