From the course: Playwright Essential Training: Abstractions, Fixtures, and Complex Scenarios
Unlock this course with a free trial
Join today to access over 24,700 courses taught by industry experts.
Overview of network routing in Playwright - Microsoft Playwright Tutorial
From the course: Playwright Essential Training: Abstractions, Fixtures, and Complex Scenarios
Overview of network routing in Playwright
- [Instructor] In the first half of this chapter, we'll be diving into one of my favorite Playwright features, the ability to interact with the network traffic during a test. This functionality can take your test design to the next level. Here are a few examples of things you can accomplish with this. You can intercept network requests, you can abort certain network requests, you can modify network requests on what's returned to the UI, you can mock network requests, or you can even simulate a slow network, and there are tons of other opportunities, but in this video we're going to walk through a few examples demonstrating each one with code. First up, intercepting an API request. So this all happens within the page.route function that exists. So in this scenario, we are passing in the API for the products, so we get a list of products back, and we're routing that through this page router. We then set the response to whatever comes back from the response. We can then go in and set…
Contents
-
-
-
-
-
(Locked)
Overview of network routing in Playwright5m 8s
-
(Locked)
Intercepting HTTP requests with Playwright13m 32s
-
(Locked)
Mocking HTTP responses with Playwright11m 14s
-
(Locked)
Browser emulation in Playwright9m 35s
-
(Locked)
Localization and geolocation in Playwright3m 45s
-
(Locked)
Injecting JavaScript in Playwright11m 11s
-
(Locked)
Challenge: Mocking and emulation in Playwright1m 29s
-
(Locked)
Solution: Mocking and emulation in Playwright6m 53s
-
(Locked)
-
-
-