Rayrun
← Back to videos

Network Replay | HAR | Playwright Tutorial - Part 79

Network Replay

This video is a tutorial on a new feature in Playwright version 1.23.2 called network replay. The video starts with an introduction to the concept of HAR (HTTP Archive) files, which are used to track performance issues like bottlenecks and slow load times. The presenter demonstrates how to generate a HAR file using Chrome DevTools by inspecting the network tab and exporting the data. After that, they show how to use the HAR Analyzer from Google Apps to analyze the content of the HAR file and view details about the HTTP requests and responses.

The video then moves on to generating HAR files using Playwright. The presenter updates the Playwright version in their package.json file and runs the necessary commands to install the dependencies and update the browsers. They then show a simple script using Playwright to generate a HAR file by enabling network routing and specifying the file name and location.

After demonstrating how to generate a HAR file using Playwright, the presenter shows how to use the HAR file for network replay. They modify the script to set the update option to false, indicating that the HAR file should be used instead of making live requests. They then run the modified script, and Playwright loads the browser using the HAR file and performs the UI testing tasks specified in the script.

The presenter highlights the usefulness of HAR files for testing when the test environment or server is down. They mention that HAR files are particularly helpful when testing UI functionality that doesn't rely on external server responses, such as searching for books. However, they also mention that HAR files may not be beneficial for testing functionality that requires communication with external servers.

In conclusion, the video provides a comprehensive overview of generating and using HAR files with Playwright for network replay, showcasing the capabilities and potential benefits of this feature for UI testing.

Related Videos

How to handle multiple tabs in Page Object Model | Playwright Tutorial - Part 87
How to handle multiple tabs in Page Object Model | Playwright Tutorial - Part 87
Playwright Installation - 2022
Playwright Installation - 2022
How to download file & attach to report | Playwright Tutorial part - 68
How to download file & attach to report | Playwright Tutorial part - 68
Save Test Execution In Video | Playwright - Part 5
Save Test Execution In Video | Playwright - Part 5
TwitterGitHubLinkedIn
AboutQuestionsDiscord ForumBrowser ExtensionTagsQA Jobs

Rayrun is a community for QA engineers. I am constantly looking for new ways to add value to people learning Playwright and other browser automation frameworks. If you have feedback, email luc@ray.run.