You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When executed in headed mode using VS Code extension, the test fails with the error "Error: route.fetch: Browser has been closed"
When executed in headless mode using, the test fails with the error: "Error: route.fetch: Request context disposed"
Also execution log sometimes shows only the first GET request only, and sometimes the rest of the stack with 307 redirect and second GET call to redirect API Url
When executed in headed mode using CLI, sometimes error message is "Error: route.fetch: Protocol error (Storage.getCookies): Failed to find browser context for id"
As a result, I am unable to intercept the response of the redirected API URL to process the modified response.
The text was updated successfully, but these errors were encountered:
Similar but not duplicate in my opinion.
This one related to interaction with a redirect API call. Playwright can't fetch a response if there is a redirect.
So what happens is that you are navigating (page.goto), the browser starts a network request and its coming into your page.route handler. But the test is already tearing down, so the context is disposing while your API request is being made. If you add a page.waitForTimeout(1000) after the page.goto it works as expected. (or an expect.toHaveText etc.).
System info
Source code
Config file
Test file (self-contained)
Steps
Expected
In this test, we intercept the "https://conduit.productionready.io/api/tags" that browsers redirect with 307 code to "
https://api.realworld.io/api/tags". route.fetch() should get the response from redirected API, save it into the "response" constant, and fulfill back to complete the call.
Actual
When executed in headed mode using VS Code extension, the test fails with the error "Error: route.fetch: Browser has been closed"
When executed in headless mode using, the test fails with the error: "Error: route.fetch: Request context disposed"
Also execution log sometimes shows only the first GET request only, and sometimes the rest of the stack with 307 redirect and second GET call to redirect API Url
When executed in headed mode using CLI, sometimes error message is "Error: route.fetch: Protocol error (Storage.getCookies): Failed to find browser context for id"
As a result, I am unable to intercept the response of the redirected API URL to process the modified response.
The text was updated successfully, but these errors were encountered: