2 ms·
Related: I want to take screenshots of a few news websites for a little fake news project of mine, and most approaches return something completely different tha
by swah 10y ago
Related: I want to take screenshots of a few news websites for a little fake news project of mine, and most approaches return something completely different than what I'm seeing when I open Chrome.
Limited height would be better/ok (something like the first 3000 pixels).
Low volume / can be slow (30 seconds would be ok).
Those news websites many times have infinite scrolling.
I've tried:
- phantomJS (rendering sucked, tried every technique I could find to wait for JS to load)
- wkhtmltopdf (almost ok, generates a huge 30M image with all the height, no antialiasing it seems)
- https://github.com/gen2brain/url2img https://github.com/gen2brain/url2img (this was the best so far, uses Qt bindings but not the latest version)
- actually run a headless browser in DigitalOcean with xvfb-run and take a screenshot: I failed at this
What I didn't tried was Selenium, because it seemed even harder.
How would you guys do it?
- deleted 10y ago[deleted]
- oceanswave 10y agoCreate a chrome extension for yourself that automates the process
- stangls 10y agoI use xvfb for selenium testing. It is really easy to set up and can take screenshots or videos while automatically browsing websites.
- swah 10y agoThanks - I tried Selenium (on the desktop) with geckodriver now and it rendered well. The only thing is that long screenshots didn't work but there is probably a workaround for that.