
How to add custom styles to a page in Puppeteer
To add custom styles to any page use Puppeteer's page method `page.addStyleTag(options)`. Let's discover how it works quickly.
- Written by
- Dmytro Krasun
- Published on
Dmytro Krasun
With more than a decade of experience in software engineering, I share the best practices and solutions you can apply to your problems in the space of headless browsers. You can also find me on Twitter and LinkedIn
To add custom styles to any page use Puppeteer's page method `page.addStyleTag(options)`. Let's discover how it works quickly.
The article examines how you can take screenshots of any URL with PHP by using Selenium, Puppeteer alternatives, or screenshot API as a service.
The article examines how you can take screenshots of any URL with Javascript and TypeScript (Node.js) by using Selenium, Puppeteer alternatives, Playwright, or screenshot API as a service.
The article examines how you can take screenshots of any URL with Java by using Selenium, Puppeteer alternatives, Playwright, or screenshot API as a service.
The article examines how you can take screenshots of any URL with Go (a.k.a. Golang) by using Selenium, Puppeteer alternatives, Playwright, or screenshot API as a service.
Puppeteer allows changing the time zone on a per-page basis. In automation testing, you can use it to test how the website behaves for different time zones. Or you can use it for scrapping to imitate the user from the expected time zone by the site.
Puppeteer allows blocking any outgoing requests while loading the page. Whether you want to block ads, tracking scripts, or different types of resources, it is relatively easy to do with Puppeteer.
Puppeteer allows you to automate everything you can do in the browser manually and even more. You can take screenshots of the entire page and the specific elements.
It is easy to use proxy globally for the puppeteer instance, but there is a trick to use proxy on a per-page basis.
Making screenshots of the websites with Puppeteer can be tricky. A lot of pitfalls wait for us. Let's examine Puppeteer on a set of "screenshotting" problems and tackle arising pitfalls.
Exhaustive documentation, ready SDKs, no-code tools, and other automation to help you render website screenshots and outsource all the boring work related to that to us.