Skip to content

Coding Practice

Is Playwright Ready for Production?

After my series of 13 posts about Playwright spanning C# and Python, it is time to answer the two question I got asked a lot in the past few weeks:

Is Playwright ready for production?

Yes

Should we switch to Playwright?

It depends.

The second one is a boring answer, but if you want to have my honest opinion, then that is it. Let’s recapitulate what we covered in this blog series and add the context to the favorite answer of consultants.

Practical Tricks for Working With Playwright

When you work with Playwright, there are a few small things that you want to change. Often there is a flag for codegen or a settings value that will do the trick. I collected the customisations for the parts I find most useful. Feel free to add a comment for other tricks you think I should know about.

The customisations go in 3 basic places: The command line for changes to codegen, the BrowserTypeLaunchOptions() when we launch the browser or the context that we get from the newly created browser. If you get stuck, you best use the codegen option and then look at the generated code to copy that into your application. That works across languages and frameworks.

Recording Tests With Playwright

Test recording has a bad reputation: The generated code is brittle, ugly and contains so many details that developers do not bother to understand it – instead, they start over from scratch. Microsoft did its part in creating that bad reputation. But Microsoft learned its lessons and did a big step forward with Codegen, the test recorder for Playwright.

A Quick Start With Playwright

Playwright is a reliable end-to-end testing framework for web applications. It is open-source and available for C#, Java, JavaScript, and Python. While it is similar to Selenium and Cypress, Playwright has its own twist on testing and offers a nice set of tools to make writing tests less tedious. Since Microsoft is putting a lot of resources into Playwright, I expect it to be around for the long haul.