
I have recently automated some tests using Playwright. It is a free-to-use Node.js library created by Microsoft that is designed to be used to automate end-to-end testing.
Playwright supports chromium, WebKit and Firefox, and, by default, all tests are run on all three browsers. Tests can be run in headless mode. It supports, Java, .Net, JavaScript, TypeScript and Python. I am writing my tests in TypeScript and have used FrontendMasters TypeScript Fundamentals, v3 course to help me get up to speed with TypeScript.
Its first-party test runner is Playwright Test, although a number of test runners such as Jest\Jasmine and mocha can be used. Playwright Test feels familiar because it has describe blocks skip and other familiar functionality.
There are good resources for learning Playwright, which include free courses provided by both LambdaTest and Test Automation University.
One of Playwright’s strengths is its support for iframes. Playwright contains functionality that enables tests to interact with elements inside an iframe, giving it an advantage over many test automation frameworks. To explore how to test elements inside an iframe you can use Jonathan Thompson‘s blog post about how to use Playwrights support for iframes[1]. You can use `frame.getAttribute` and `frame.$$` to get the values of attributes in elements within an iframe, which helped my test automation. It is really helpful that you can wait for events inside an iframe, for example with frame.waitForFunction().
Playwright has good easy-to-use documentation, however, you may not find what you are looking for. If you can’t find the item you want in Playwrights documentation, search in google for it. I wanted to find a way to have some tolerance for changes in screenshots. When I searched for tolerance in the documentation I found nothing, but when I searched for it in google I found the PR for the change that created the functionality I wanted. The PR gave me all the information I needed.
Playwright is a useful addition to your test automation tools.
References
[1] Jonathan Thompson Handling Iframes using Python and Playwright
Resources
- Playwright Documentation: https://playwright.dev/docs/intro
- A Playwright sandbox: https://try.playwright.tech/
- Playwright community: https://playwright.tech/
- GitHub repo: https://github.com/microsoft/playwright
- LambdaTest Playwright Certifications: https://www.lambdatest.com/certifications/
- Test Automation University Course on Playwright: https://testautomationu.applitools.com/js-playwright-tutorial/















