1×
Become a member
to unlock all features

Level Up!

Access all courses & lessons on egghead today and lock-in your price for life.

Autoplay

    Using Playwright to screenshot the DOM and return an image from a Netlify Function

    netlifyNetlify

    We cover installing Playwright, which will run the headless browser for us, in a way that doesn't also install unused browser bundles, reducing the size and allowing us to deploy it to netlify in a function. We also cover a set of Playwright APIs like page.setContent, page.evaluate, page.screenshot, and how to return a base64 encoded image from a lambda function. We also cover passing values from native browser functions like getBoundingClientRect back to our node script and fixing a few errors along the way.