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] Unable to redirect url using Page.route

See original GitHub issue

hi, i tried to make a redirection on XHR on another url unsucessfully here is what i tried unsuccessfully:

await page.route('https://www.wikipedia.org/portal/wikipedia.org/assets/img/Wikipedia-logo-v2@1.5x.png', (request) => {
  request.continue({url: 'https://www.wikipedia.org/portal/wikipedia.org/assets/img/Wikinews-logo_sister@2x.png'});
}
await page.goto('https://www.wikipedia.org/');

and

await page.route('https://www.wikipedia.org/portal/wikipedia.org/assets/img/Wikipedia-logo-v2@1.5x.png', (request) => {
  request._url = 'https://www.wikipedia.org/portal/wikipedia.org/assets/img/Wikinews-logo_sister@2x.png';
  request.continue();
}
await page.goto('https://www.wikipedia.org/');

Could you provide me a good way to do it?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:11 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
AnnaIvakhnikcommented, Nov 11, 2020

Hi! Thank you for the solution! It works great for me while running chromium and firefox, but does not work for WebKit 😦 Do you know what could be the problem? ps: it not the cors problem, but i tried adding header ‘Access-control-allow-origin’: ‘*’, Playwright 1.5.2 WebKit 14.0 Ubuntu 18.04

1reaction
yury-scommented, Nov 11, 2020

There is a bug in WebKit implementation of fulfill, I’ll have a look.

Read more comments on GitHub >

github_iconTop Results From Across the Web

javascript - Angular 9 : Unable to redirect to a specific route in ...
Now I am getting redirected to the external payment page where I can make the payment or cancel the transaction. If I click...
Read more >
How to Use JavaScript to Redirect a URL - Semrush
Learn 3 of the most common ways to redirect a URL using JavaScript the location object: setting a new window.location.href property, ...
Read more >
Redirections in HTTP - MDN Web Docs - Mozilla
URL redirection, also known as URL forwarding, is a technique to give more than one URL address to a page, a form, or...
Read more >
How to redirect a URL for a domain? - Namecheap
I am moving my site from one server to another and will do a permanent either A record or redirect later, and I...
Read more >
Redirects and Google Search | Documentation
If you just want to send users to a different page temporarily, use a temporary redirect. This will also ensure that Google keeps...
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