Rayrun
← Back to Discord Forum

Intercepting multiple requests

Hello, I am have an application that does multiple graphql calls. I am trying to intercept 2 specific post calls but at any given time I am only able to intercept 1 call. Is there documentation on how to intercept multiple calls? I tried defining multiple await request.route but it did not work as expected.

This thread is trying to answer question "How can I intercept multiple post calls in my application?"

7 replies

Intercepting multiple requests

page.route will intercept and handle all requests matching your pattern until you close the page or use page.unroute, no need to call it twice (unless you want to use route.fallback).

https://playwright.dev/docs/api/class-page#page-route

I actually noticed that the intercept stopped after the first matching call and did not work beyond that

Thank you for the response @hubspace

HubSpace is right. Normally page.route should work for the lifetime of the page. So there must be something in your code that makes it work differently. Can you show the relevant code?

Sounds like you did not call any of the route.abort, continue, fallback or fulfill methods in your handler. But if you did it could be anything. Maybe even your application is sending the requests differently.

@hubspace: Could you elaborate on that? I have a similar issue (https://discord.com/channels/807756831384403968/1157391025401253948) and maybe you can help me to understand it better

Could you elaborate on that? I have a similar issue (https://discord.com/channels/807756831384403968/1157391025401253948) and maybe you can help me to understand it better

Related Discord Threads

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 [email protected].