-
Notifications
You must be signed in to change notification settings - Fork 164
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
Wait for sometime ( webpage loading fully)before taking the screenshot #22
Comments
Hello, To my understanding there's no easy way to know if a page is fully loaded or not. That's why I chose the So try to play with the Otherwise:
Cheers. |
@milangfx, thanks. |
Good questions. I didn't have any failures, I was not using the If I remember correctly, at one point a page didn't fully load even with 1400 and 1800, so a bit higher values might be needed for consistent results, something like 2400 - 2800 (?) I've only tested this with individual URLs so far. My only concern is that this could potentially increase the run time a lot if multiple URLs don't load immediately (or before the default 400 - 800). |
No, the
Yes that would be appreciated, run
I think I've already did these kind of tests far in the past, I don't really remember the results but that global increase of duration actually rings a bell to me.
If the tests show that the global duration is increased, I'll keep the current values but implement an option to handle these parameters and document somewhere that they should be specified in case of partial screenshots. |
What I meant is that if PhantomJS already stops at the 800 ms I ran three test on 100 URLs, one with the default timeout values, one with 1000 ms added and one with 1500 ms added.
So there's a trade-off between run time and pages actually loading. |
I'm not sure to read well the figures, the total time is 1m10s (70s)for the first case, 1m37s (97s) for the second and 1m44s (104s) for the third one ? It's only +50% duration increase for more than +100% successful screenshots. It is worth it, the primary goal of such tool is to perform the maximum number of successful screenshots. The execution duration is already addressed through multiprocessing and cannot/doesn't have to be more optimized by lowering the number of successful results. So I might use the 1900/2300 values and offer a user option to specify them. Cheers. |
Correct.
Yeah, depends on how you define successful. In my example above, the blank page technically loaded successfully, but there was important content missing since I also wanted the mailing lists to show up so I had to wait a bit longer. This is just a test with Google Groups, really. Other pages might behave differently. What's important content will always depend on the user. Maybe the user wants the ads to load and see how they are displayed. If you want to set a higher default, I would go for around A too high default max timeout can hang the process unnecessarily, e.g. if there's an ad server not responding. |
Got it, that's clear. |
|
Thanks for the quick implementation! Works like a charm. |
Thank you for your feedbacks @milangfx |
Hi, I am not very familiar with phantomjs and chrome's api.
So how should I change the source code to take the screenshot after the webpage is fully-loaded ?
The text was updated successfully, but these errors were encountered: