Live data from Hacker News

Playwright: Automate Chromium, WebKit and Firefox

github.com

51–60 of 149 posts

Re: Playwright: Automate Chromium, WebKit and Firefox

#52

Earlier quoted context omitted.

While I have not used Playwright (but have a lot of experience with Se), I would say the code style is refreshing: // Expect an element "to be visible". await expect(page.locator('text=Learn more').first()).toBeVisible(); Writing await for every action makes the timeout of the action seem more explicitly declared. There seems to be more granular control of timeouts as well https://playwright.dev/docs/test-timeouts >…

> If the execution in .NET is slow then I suppose it could be .NET. But it could be (and often is) the suite design. You must wait for /everything/ before interacting with it That's what I do, but the wait for an element in certain tests times out after a few minutes, even though the elements are clearly visible, and manual use never has an issue. From other comments it sounds like Puppeteer and Playwright are better…

When I fixed many similar selenium/webdriver tests the root cause was always the same: You grab reference to an element and for example wait it to become enabled or some text to appear. But your ui framework actually replaces the element in the dom while doing its thing and your reference to stale element will never change. Fix is to loop searching the element with selector and check if the element fills the conditions. If not, retry from search again. We had nice helpers for those and had very stable selenium tests.

Re: Playwright: Automate Chromium, WebKit and Firefox

#53
post #39

Interesting tidbit: One of the main contributors of this project[0], was the core contributor (creator?) of Puppeteer[1], but then I guess left Google to join Microsoft and work on this[2][3]. [0] - https://github.com/aslushnikov [1] - https://github.com/puppeteer/puppeteer/ [2] - https://github.com/microsoft/playwright/graphs/contributors [3] - https://github.com/microsoft/playwright/graphs/contributors

I wonder what the story is there. Why wouldn't MS just have him continue to work on Puppeteer? They're both open source, so there's not much point in "owning" their own clone of it.

Re: Playwright: Automate Chromium, WebKit and Firefox

#55
post #53
post #39

Interesting tidbit: One of the main contributors of this project[0], was the core contributor (creator?) of Puppeteer[1], but then I guess left Google to join Microsoft and work on this[2][3]. [0] - https://github.com/aslushnikov [1] - https://github.com/puppeteer/puppeteer/ [2] - https://github.com/microsoft/playwright/graphs/contributors [3] - https://github.com/microsoft/playwright/graphs/contributors

I wonder what the story is there. Why wouldn't MS just have him continue to work on Puppeteer? They're both open source, so there's not much point in "owning" their own clone of it.

From what I know puppeter works only with chromium, this could be deal breaker for microsoft

Re: Playwright: Automate Chromium, WebKit and Firefox

#56
Playwright is great, especially if you are dealing with test cases that span multiple domains/contexts. I had to test some user flows which involved logging into two apps, each with three different users to perform and validate various actions. Playwright's context switching made it a breeze. Also, it offers a nice separation of browser automation and test runner API, so it can be used outside of E2E testing as well.

Re: Playwright: Automate Chromium, WebKit and Firefox

#57
post #18

What do people thing of playwright vs cypress? I've been considering using playwright instead as it supports more browsers and I feel like it's easier to do production monitoring (by putting it in a aws lambda or using checkly) - Cypress: https://www.cypress.io - Playwright aws lambda: https://github.com/PauloGoncalvesBH/running-playwright-on-aw... - Checkly: https://www.checklyhq.com

We see a strong adoption of Playwright. It’s the default we recommend to users now. We also support Puppeteer, but its development is lagging. Having said that, I would love to support Cypress if I had infinite time and focus. Side note: Selenium is not on the menu, even with its large install base. We are aiming for where the puck is going and it’s going to Playwright. Full disclaimer: I’m CTO at Checkly.

The checkly folk recently published this

https://blog.checklyhq.com/cypress-vs-selenium-vs-playwright...

Cypress vs Selenium vs Playwright vs Puppeteer speed comparison

Re: Playwright: Automate Chromium, WebKit and Firefox

#58
post #48

For generating PDFs like invoices in a webapp, is libraries like this the way to go these days or is still using a pdf lib the norm? Pros of Playwright/Puppeteer: Reuse existing HTML/CSS knowledge Cons: Requires an external service or shelling out to an external process Pros of using a pdf lib: Probably better performance, simpler architecture by being in-process. Cons: Ad-hoc language for designing the PDF.

It's very simple to use either, there are loads of example implementations on GitHub.

I used one based on docker, and the bottleneck was actually sending the html, css you want to print (if it's not already served over http). I used a shared docker volume to write to from one process (python) and read from another (the node pupetter).

It all comes down to, load html, wait to load, save to pdf. Very simple, fast, and reliable. More so than weasyprint for example.

Re: Playwright: Automate Chromium, WebKit and Firefox

#59

What do people thing of playwright vs cypress? I've been considering using playwright instead as it supports more browsers and I feel like it's easier to do production monitoring (by putting it in a aws lambda or using checkly) - Cypress: https://www.cypress.io - Playwright aws lambda: https://github.com/PauloGoncalvesBH/running-playwright-on-aw... - Checkly: https://www.checklyhq.com

We recently picked playwright for a project because we could do more with the "mouse". With playwight you can click coordinates on the page. I did not find an easy way to do this using cypress. Aside from that, playwright seems to be so much faster.

Re: Playwright: Automate Chromium, WebKit and Firefox

#60
post #55
post #53

Earlier quoted context omitted.

I wonder what the story is there. Why wouldn't MS just have him continue to work on Puppeteer? They're both open source, so there's not much point in "owning" their own clone of it.

From what I know puppeter works only with chromium, this could be deal breaker for microsoft

Edge is chromium though.
Post reply on HN