6/10/2023 0 Comments Noda screenshot pathHaving to deal with all of the edge-cases that go along with that, we recommend using a screenshot API such as urlbox. If you want to quickly add website screenshots or PDFs to your project without all the hassle of maintaining your own screenshot service, and Nightmare.js and Phantom.js are no longer being maintained and therefore not recommended. Supported and give you the ability to use the most recent browsers.Įlectron could be used but it is primarily a development platform for building cross-platform desktop applicationsĪnd so using it to take screenshots can feel quite clunky and is not a primary use-case. We would recommend using puppeteer or playwright to capture website screenshots as they are both well In this article we have seen how to generate website screenshots in node.js using a variety of different tools. This just demonstrates how easy it is to get the perfect screenshot using the urlbox API and it's many options. Now if we inspect the resulting screenshot, we see the ad container is no longer showing: This means it could easily be used for cross-browserįirst let's install playwright using npm:Ĭonst ) The great thing about playwright is that it can be used to automate chromium,įirefox and webkit using the same API. The API is very similar to puppeteer, in fact some of the original developers of puppeteer are now working on developing and maintaining playwright. Playwright is the new kid on the block of headless browser automation libraries. ![]() Use Playwright to capture website screenshots We have built urlbox to solve these problems and more. If you're looking for a solution that automatically blocks ads from screenshots and hides cookie banners for you, This is a common issue with taking website screenshots, and can be time consuming to fix. The screenshot generated is named nyt-puppeteer.png and looks like this:Īs you can see, most of the screenshot is taken up by an ad on the top, and a cookie banner on the bottom.
0 Comments
Leave a Reply. |