Skip to content
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

Feature to scroll through website so images are loaded #67

Open
RSully opened this issue Mar 5, 2014 · 12 comments
Open

Feature to scroll through website so images are loaded #67

RSully opened this issue Mar 5, 2014 · 12 comments
Labels

Comments

@RSully
Copy link

RSully commented Mar 5, 2014

I attempted to capture an imgur album, and the result was a capture with only the top ~20% of images loaded.

@paulhammond
Copy link
Owner

Does adding a --delay=5 option make it better?

If not, I think this might be caused by imgur not loading images that are below the "fold" until you scroll the page into view (which would mean this bug is somewhat similar to #60). Which would be messy but maybe not impossible to fix...

@RSully
Copy link
Author

RSully commented Mar 5, 2014

Adding the delay does not help.

If I add --delay=5 --js='window.scrollTo(0, document.body.scrollHeight);' then the top and bottom images are loaded, with the middle ones lost. (Though now the right sidebar is at the bottom of the page instead of the top.)

I read your comments in #60, and while I understand the concepts and problem, I can't come up with any solutions.

Edit: can't quite think of a good name to rename this issue to, either

@paulhammond
Copy link
Owner

Just scrolling to the bottom won't work as the JS on the page is smart enough to only load the visible images (and not any above the viewport). Try this:

--js='var i=0; function scroll(){ i += 600; if (i > document.height) { window.scrollTo(0,0);webkit2png.start() } else { window.scrollTo(0, i); window.setTimeout(scroll, 500)}}; webkit2png.stop(); scroll();'

Does that work?

@RSully
Copy link
Author

RSully commented Mar 11, 2014

That doesn't work - only loads the top few. (Tried 5s, 20s and no delay.)

@paulhammond
Copy link
Owner

Do you have a sample gallery I can test against? I've tried using their random functionality to get test cases, but they're all relatively short and work with the js above...

@RSully
Copy link
Author

RSully commented Mar 11, 2014

This should be a good example: http://imgur.com/a/1S2u5

@paulhammond
Copy link
Owner

Oh. I'm using the latest development version, I think you're probably using the last release (0.6) which doesn't have the functionality to wait for async JS before capturing

Could you try downloading the latest development version and see if it works then?

@RSully
Copy link
Author

RSully commented Mar 12, 2014

I am using homebrew's formula.

Do you think we could get to a point soon for another release? A year really hurts when people using the stable version try to submit bug reports, apparently 😉

Edit: tomorrow I'll download and +x the script manually in a testing folder

@RSully
Copy link
Author

RSully commented Jun 13, 2014

Using the latest release the --js above mostly works (the last image didn't have enough time to load fully).

@Saeven
Copy link

Saeven commented Jan 15, 2016

Related, unrelated -- is the delay in seconds?

-h only writes:

Web page functionality:
    --delay=DELAY       delay between page load finishing and screenshot

Would be a kind specification! :)

@paulhammond
Copy link
Owner

@Saeven yes. The documentation was updated in #98

@paulhammond
Copy link
Owner

I've been seeing this issue on more and more sites recently, especially news websites. I think a feature to automatically scroll through a website and wait a second for images to load might be useful.

@paulhammond paulhammond changed the title Doesn't wait for all images to load Feature to scroll through website so images are loaded Mar 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants