-
Notifications
You must be signed in to change notification settings - Fork 63
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Too early timeout / timeout not controllable #135
Comments
I've improved the implementation by adding a watchdog after the network event is triggered. If a new network event is triggered meanwhile, the watchdog is reset. Hopefully, this should fix your issue. The watchdog delay value can be set with the new |
Thank you @gildas-lormeau for the head-up. Sounds good, I will test it as soon as it's available. What exactly is the "browser-wait-until-delay" with only 1 second as default timing? Do you suggest to keep it at default for my issue above or rather go to 10 or more seconds? 1 second for a watchdog is pretty short, but I probably misunderstand the meaning of this option. Would be great if you write down a clear description in the help file. For the other option " --browser-wait-until" I also suggest to improve the help text. At least I don't really understand what those cryptic options mean. Since you did not mention this, am I right that this option does not help solving my issue? |
I've updated |
This comment was marked as outdated.
This comment was marked as outdated.
@emp-00 Sorry for the late reply, did you to use the option |
@gildas-lormeau : Yes, I did and I am still using it. However, I cannot 100% tie the option to "success" or "failed". What I do: I am pulling data from a personal photovoltaics monitoring status-webpage every 15mins. Practically daily I run into the situation single-file only downloads the "hourglass page" (see above). When I open the webpage in the same chrome browser manually at the same time, the page opens normally after showing the hourglass page just for usually 5 seconds. My standard call uses "--browser-wait-until-delay=25000" (25 secs); Yesterday I tried removing the option when the download always failed (every 15 mins, for ~2 hours) and then the single-file download suddenly worked but in the next 15 min cycle it again only downloaded the hourglass page. I also tried 2500, 5000 and 10000 ms -> sometimes it works, sometimes it does not. From my best guess, it's a problem from single-file which does not really work with "my status-page". Only very rarely I find that the page has a delay of more than 10 seconds and still with 25000 ms this should also be covered, which is doesn't ... I'm puzzled. Can you see something in the hourglass html code that explains why single-file does not wait sufficiently long for the regular page to be displayed? Stupid question: What exactly does "browser-wait-until-delay" do? You explained it's a watchdog timer. I clearly noticed, that the single-file execution always takes at least as long as this "delay": I therefore have a feeling that this option is just a "delay" before single-file downloads the page? So it does not start downloading and then waits at least 25 secs? Maybe there's a glitch in the code for this option? I only leave it at 25 secs because I see that the download takes longer - believing that this helps, but my gut feeling says differently. Your description reads "delay of time in ms to wait before considering the page is loaded when the value of --browser-wait-until is reached" --> honestly, I still don't fully understand what "the value of ..." really means. Those values mentioned for the other option, I just don't understand them. Maybe I need to use a different "value" for the other option (--browser-wait-until)? Thanks for your time + efforts, single-file.exe is really a great tool! |
You could make it 100% reliable by injecting a script used to wait for the dynamic content of the status page. This can be done with the For example, this demo page https://gildas-lormeau.github.io/tmp/index-popup.html displays "Hello!" after a delay between 2s and 7s. So, if you run the command This can be fixed by creating a script file (e.g. "script.js") with the content below and running const CSS_SELECTOR_TO_WAIT = ".popup-container > div";
dispatchEvent(new CustomEvent("single-file-user-script-init"));
addEventListener("single-file-on-before-capture-request", async event => {
event.preventDefault();
await waitForElement(CSS_SELECTOR_TO_WAIT);
dispatchEvent(new CustomEvent("single-file-on-before-capture-response"));
});
function waitForElement(selector) {
return new Promise(deferWaitForElement);
function deferWaitForElement(callback) {
setTimeout(() => {
if (document.querySelector(selector)) {
callback();
} else {
deferWaitForElement(callback);
}
}, 1000);
}
} You can also use this script as-is. All you need to do is to change the value of
A new option |
Thanks @gildas-lormeau for the --browser-script idea!
This seems to work :-) regarding the js-script waiting for the page to fully load (still to be confirmed with a longer testing period). However, I notice, that Could you check if this is my fault or maybe there's a bug in single-file.exe? No errors are displayed but the filenames of the two first pages in URL-List.txt are definitely not generated with the desired template format. Maybe |
Thank you for the feedback, the |
@gildas-lormeau : Thank you very much - I confirm "Last question": Is there any timeout for the |
I've added the option |
I'm closing the issue because the option |
This is another issue in the context of #134
In this case I can confirm it's not only happening with thorium but also with chrome (Win11, latest single-file revision).
Symptom:
Obviously, in this case single-file.exe is stopping/terminating the chrome instances too early. Expected behavior is to fully download the pages...
From my observations, I have a feeling that currently 30 seconds timeout is hardcoded in single-file.exe?? This may be completely wrong, or I might be doing something stupid - any help is much appreciated to make my download process more reliable...
I was looking into below option but I don't fully understand "what to use", "what the options mean", so have not tested any of those yet.... Is this the path forward for my issue?
--browser-wait-until: When to consider the page is loaded (InteractiveTime, networkIdle, networkAlmostIdle, load, domContentLoaded) <string> (default: "networkIdle")
The text was updated successfully, but these errors were encountered: