automa icon indicating copy to clipboard operation
automa copied to clipboard

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

Open ZhangWei55kai opened this issue 1 year ago • 1 comments

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

ZhangWei55kai avatar Aug 07 '24 07:08 ZhangWei55kai

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

jingbof avatar Sep 06 '24 02:09 jingbof