What is the Playwright framework:
Built by the Microsoft team, It is a framework for end-to-end testing and automation, slowly gaining popularity.
Moreover, It is an open-source test automation library and It’s easy to set up, feature-packed, and one of the fastest, most reliable frameworks.
Playwright comes with the ability to generate tests out of the box and hence is a great way to quickly get started with testing.
It will open two windows, a browser window where you interact with the website you wish to test and The Playwright Inspector window where you can record your tests, copy the tests, clear your tests as well as change the language of your tests.
Steps for record test in Playwright:
- Firstly, we will enter the command ” npx playwright codegen ” in the terminal. we can also use the command with the URL of the website like ” npx playwright codegen https://www.saucedemo.com/ ” further after entering the above command you will get a playwright inspector (recording window) like this and also open a given website
2. After that we will test the website In the above website I am testing login and logout functionality and as you start you don’t have to write the code It will automatically write in the playwright inspector .
In this case we will click the stop or pause button and copy the code and also as you start testing then you will get locator as you click on the element.
In addition, there are features like you can stop the recording, and copy the code.
4. In addition, to see the reports give the command npx playwright show-report in the terminal and you will see the reports in the browser in HTML format.
It is very easy to record tests in a playwright you just have to follow the above steps