question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Question] - Routing

See original GitHub issue

Hi!

I have a question about page.route() , I am not sure if I am using it properly.

I have the following code in a fixture:

await page.route('**/*', route => {
    if (route.request().url().includes('blocker') || route.request().url().includes('testing')) {
        route.abort()
    }
    else {
        route.continue();
    }
})
await page.goto(url)

Then on my test:

//Some stuff
await page.waitForUrl("something")

If I am not wrong, I have noticed that “routing” gets executed again when page.waitForUrl() is called, could it be the case?. Is this a correct usage ? I only want to block some request on the initial navigation (page.goto()), should I use “unroute()” after that to prevent this ?

Thanks a lot!

Issue Analytics

  • State:closed
  • Created 10 months ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
dgozmancommented, Nov 26, 2022

@imartinflores Once setup, route affects all requests matching the pattern, so it is usually called multiple times. Unrouting is a good solution here. You can also narrow down the pattern to only route some requests, not all of them.

const abortPattern = /blocker|testing/;
await page.route(abortPattern, route => route.abort());
await page.goto(url);
await page.unroute(abortPattern);
0reactions
dgozmancommented, Nov 27, 2022

Closing as per above.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Personalized Question Routing via Heterogeneous Network ...
Question Routing (QR) on Community-based Question Answering (CQA) websites aims at recommending answerers that have high probabilities of providing the ...
Read more >
Creating a survey with routing | Attest Help Center
You can route respondents from their answers to single or multiple choice questions. In list view, select Route answers in the bottom right...
Read more >
Question Routing (skip logic) - Snap Surveys
Control which questions each participant will see with Snaps uniquely powerful and flexible question routing. Routing rules can be based on ...
Read more >
What is routing and how do I use it? | iSurvey News and Help
Routing is an efficient way of only displaying relevent questions to participants. For example, if you have a question 'Do you own a...
Read more >
Feature-based question routing in community question ...
The success of these platforms dependent on how efficiently new questions are assigned to community experts, known ascalled question routing.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found