DEV Community

If you consider Puppeteer cool, then playwright is awesomeness 😍

Yaser Adel Mehraban on January 23, 2020

If you've ever used Puppeteer, you'd know it enables you to control a Chrome instance (or any other Chrome DevTools Protocol based browser) and exe...
Collapse
 
fredericbonnet profile image
Frédéric Bonnet

Awesome work! I'm already in love with Playwright. What I really appreciate as a developer is the seamless integration with Firefox and WebKit and not just Chromium, with no extra step to integrate or configure anything. WebDriver can be tedious on these points.

I have a pet project of mine called Instakittens that serves as a playground for testing frameworks (think TodoMVC, but for tests). I already have several test suites that use Puppeteer for browser automation, with Jest, Mocha and Cucumber as test runners. When I saw the announcement for Playwright on Twitter I had the urge to give it a try. Incredibly enough, it took me only a few hours to port the Puppeteer-based suites to Playwright with almost zero compatibility issue: apart from the initialization, I only had to replace {visible: true} / {hidden: true} to {visibility: 'visible'|'hidden'} in selectors.

Collapse
 
yashints profile image
Yaser Adel Mehraban

Awesome work, I’ll check out your repo for sure, will save me a few hours at least 🙂

Collapse
 
evanplaice profile image
Evan Plaice

Does playwrite download its own version of the browser like Puppeteer, or can it use an existing install?

Collapse
 
arjunattam profile image
Arjun Attam

You can use it with an existing install, and avoid the binaries from getting downloaded. Check out the playwright-core NPM package, which does not install the binaries. We want to ensure your tests run fast and if your setup does not need the browser to be downloaded, you shouldn't have to wait.

Collapse
 
evanplaice profile image
Evan Plaice

Awesome! Thank you 🙏

Collapse
 
yashints profile image
Yaser Adel Mehraban

It downloads the binaries from official channels, not sure you can use an existing or not, will look it up

Collapse
 
evanplaice profile image
Evan Plaice

Thanks. That's my biggest issue with E2E testing FWs.

I'd like to be able to npx playwright and have the tests run instantly. Rather than wait 5 min for a download.

Thread Thread
 
yashints profile image
Yaser Adel Mehraban

Might happen, it’s open source, check the issues and see if something exists. Up vote or create one 🙂. Even better create a PR if that’s your thing

Collapse
 
skhmt profile image
Mike

Can you use Playwright to create an Electron-like system, but with Firefox instead of Chromium?

Collapse
 
yashints profile image
Yaser Adel Mehraban

It’s a bit early to be sure, but I see the potential

Collapse
 
julienverkest profile image
Julien Verkest

Great tool!

Collapse
 
mikeborozdin profile image
Mike Borozdin

How does it address flakiness in E2E tests though? If it's true than it could be as good as Cypress (little flakiness) and Selenium (multiple browser support) combined.

Collapse
 
yashints profile image
Yaser Adel Mehraban

I’ll be exploring this further as I mentioned, if you have a codebase with e2e tests, do try it out and give feedback as well

Collapse
 
gabbersepp profile image
Josef Biehler

How does Playwright communicate with the browsers?

Chromium is accessed via CDP as far as I know. But for the rest I found nothing.

Collapse
 
yashints profile image
Yaser Adel Mehraban

Have a look at connect method on this file for example

github.com/microsoft/playwright/bl...

Collapse
 
nicoandmee profile image
Nico Kokonas

Yes I am extremely excited to start using this library

Collapse
 
endtest_io profile image
endtest

We built a cloud platform where anyone can create, manage and execute automated tests for Web and Mobile Applications.

We would love to get some unbiased feedback from your side.

endtest.io