# Playwright vs. Puppeteer: Which Should You Choose? - LogRocket Blog ![rw-book-cover](https://readwise-assets.s3.amazonaws.com/static/images/article4.6bc1851654a0.png) URL:: https://blog.logrocket.com/playwright-vs-puppeteer/ Author:: Hacking Away On Sublimefund.Org ## Highlights > However, Selenium has a reputation for being unreliable. Selenium tests are commonly flaky, failing intermittently for non-obvious reasons that are difficult to reproduce. ([View Highlight](https://instapaper.com/read/1356174955/14767538)) > Selenium is also fairly resource-heavy ([View Highlight](https://instapaper.com/read/1356174955/14767539)) > programmers started using headless browsers in some cases. These browsers do most of the work of full browsers, but they don’t actually render the UI. PhantomJS was one of the more popular ones. ([View Highlight](https://instapaper.com/read/1356174955/14767540)) > Selenium uses the WebDriver protocol, which requires running a server that acts as an intermediary between Selenium and the browser. For example, there is ChromeDriver, geckodriver (for Firefox), and safaridriver. This requirement for a special server adds complexity. > Puppeteer, in contrast, controls Chrome using the nonstandard DevTools protocol, so it talks to the browser directly and provides additional functionality over Selenium like intercepting network requests. ([View Highlight](https://instapaper.com/read/1356174955/14767541)) > We gained a new option when Microsoft released the first public version of Playwright on 31 January 2020. > If you compare the contributor pages for Playwright and Puppeteer, you’ll notice the top two contributors to Puppeteer now work on Playwright. The Puppeteer team essentially moved from Google to Microsoft and became the Playwright team. > As a result, Playwright is very similar to Puppeteer in many respects. The API methods are identical in most cases, and Playwright also bundles compatible browsers by default. > Playwright’s biggest differentiating point is cross-browser support. It can drive Chromium, WebKit (the browser engine for Safari), and Firefox ([View Highlight](https://instapaper.com/read/1356174955/14767542)) > However, the Playwright team’s approach to cross-browser support is controversial. They ship Playwright with patched versions of WebKit and Firefox ([View Highlight](https://instapaper.com/read/1356174955/14767544)) > Yet these are still changes that have not been developed in conjunction with the WebKit and Firefox teams. While it’s possible that these changes might get merged in eventually, that is not guaranteed. The Playwright team might have to indefinitely maintain these changes, which could affect the long-term reliability of Playwright’s cross-browser support. ([View Highlight](https://instapaper.com/read/1356174955/14767545)) > For example, Playwright’s page.click waits for the element to be available and visible by default. ([View Highlight](https://instapaper.com/read/1356174955/14767546)) > Playwright has a more powerful browser context feature that lets you simulate multiple devices with a single browser instance. ([View Highlight](https://instapaper.com/read/1356174955/14767547)) > const { chromium, devices } = require("playwright"); > (async () => { > const browser = await chromium.launch(); > for (const deviceName of ["iPhone 11", "iPad Pro 11"]) { > const context = await browser.newContext({ > ...devices[deviceName] > }); > const page = await context.newPage(); > await page.goto('http://github.com'); > await page.screenshot({ > path: `github-${deviceName.replace(/ /g, "-")}.png` > }); > } > await browser.close(); > })(); ([View Highlight](https://instapaper.com/read/1356174955/14767548)) > I think the three main factors to consider are cross-browser support, long-term library support, and your particular use case for browser automation. ([View Highlight](https://instapaper.com/read/1356174955/14767549)) > For testing specifically, Cypress has also become a popular choice. It has a unique approach of running in band with your website code, making tests more reliable. It recently added beta Firefox and Edge support. ([View Highlight](https://instapaper.com/read/1356174955/14767550)) --- Title: Playwright vs. Puppeteer: Which Should You Choose? - LogRocket Blog Author: Hacking Away On Sublimefund.Org Tags: readwise, articles date: 2024-01-30 --- # Playwright vs. Puppeteer: Which Should You Choose? - LogRocket Blog ![rw-book-cover](https://readwise-assets.s3.amazonaws.com/static/images/article4.6bc1851654a0.png) URL:: https://blog.logrocket.com/playwright-vs-puppeteer/ Author:: Hacking Away On Sublimefund.Org ## AI-Generated Summary None ## Highlights > However, Selenium has a reputation for being unreliable. Selenium tests are commonly flaky, failing intermittently for non-obvious reasons that are difficult to reproduce. ([View Highlight](https://instapaper.com/read/1356174955/14767538)) > Selenium is also fairly resource-heavy ([View Highlight](https://instapaper.com/read/1356174955/14767539)) > programmers started using headless browsers in some cases. These browsers do most of the work of full browsers, but they don’t actually render the UI. PhantomJS was one of the more popular ones. ([View Highlight](https://instapaper.com/read/1356174955/14767540)) > Selenium uses the WebDriver protocol, which requires running a server that acts as an intermediary between Selenium and the browser. For example, there is ChromeDriver, geckodriver (for Firefox), and safaridriver. This requirement for a special server adds complexity. > Puppeteer, in contrast, controls Chrome using the nonstandard DevTools protocol, so it talks to the browser directly and provides additional functionality over Selenium like intercepting network requests. ([View Highlight](https://instapaper.com/read/1356174955/14767541)) > We gained a new option when Microsoft released the first public version of Playwright on 31 January 2020. > If you compare the contributor pages for Playwright and Puppeteer, you’ll notice the top two contributors to Puppeteer now work on Playwright. The Puppeteer team essentially moved from Google to Microsoft and became the Playwright team. > As a result, Playwright is very similar to Puppeteer in many respects. The API methods are identical in most cases, and Playwright also bundles compatible browsers by default. > Playwright’s biggest differentiating point is cross-browser support. It can drive Chromium, WebKit (the browser engine for Safari), and Firefox ([View Highlight](https://instapaper.com/read/1356174955/14767542)) > However, the Playwright team’s approach to cross-browser support is controversial. They ship Playwright with patched versions of WebKit and Firefox ([View Highlight](https://instapaper.com/read/1356174955/14767544)) > Yet these are still changes that have not been developed in conjunction with the WebKit and Firefox teams. While it’s possible that these changes might get merged in eventually, that is not guaranteed. The Playwright team might have to indefinitely maintain these changes, which could affect the long-term reliability of Playwright’s cross-browser support. ([View Highlight](https://instapaper.com/read/1356174955/14767545)) > For example, Playwright’s page.click waits for the element to be available and visible by default. ([View Highlight](https://instapaper.com/read/1356174955/14767546)) > Playwright has a more powerful browser context feature that lets you simulate multiple devices with a single browser instance. ([View Highlight](https://instapaper.com/read/1356174955/14767547)) > const { chromium, devices } = require("playwright"); > (async () => { > const browser = await chromium.launch(); > for (const deviceName of ["iPhone 11", "iPad Pro 11"]) { > const context = await browser.newContext({ > ...devices[deviceName] > }); > const page = await context.newPage(); > await page.goto('http://github.com'); > await page.screenshot({ > path: `github-${deviceName.replace(/ /g, "-")}.png` > }); > } > await browser.close(); > })(); ([View Highlight](https://instapaper.com/read/1356174955/14767548)) > I think the three main factors to consider are cross-browser support, long-term library support, and your particular use case for browser automation. ([View Highlight](https://instapaper.com/read/1356174955/14767549)) > For testing specifically, Cypress has also become a popular choice. It has a unique approach of running in band with your website code, making tests more reliable. It recently added beta Firefox and Edge support. ([View Highlight](https://instapaper.com/read/1356174955/14767550))