[BUG] New tab with redirection, can't verify initial url
See original GitHub issueContext:
- Playwright Version: 1.3.0
- Operating System: windows
- Node.js version: v14.2.0
- Browser: chromium
- Extra:
Code Snippet
Test repository to see the bug in action (both server and e2e-tests project are provided): https://github.com/boogie77/playwright-redirect-detection
Describe the bug
The issue is related to new tab being opened with initial URL /foo
that is resolved (status 307, to /bar
) with redirection to /bar
URL.
Playwright resolves context.waitForEvent('page')
too late, and we can’t verify the initial URL (/foo
). When it’s resolved it’s already on /bar
.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:5 (3 by maintainers)
Top Results From Across the Web
How to Solve This Webpage has a Redirect Loop Problem
Solution of "This Webpage has a redirect loop" or "Error 310 (net::ERR_TOO_MANY_REDIRECTS): there were too many redirects" in Chrome and Mozilla Firefox.
Read more >738724 - Chrome tabs not redirecting back to app without user ...
The issue we are facing is after successful sign-in , we are intercepting callback url via intent filter , which has session information...
Read more >How does a site redirect existing tab when visiting it in a new tab
If I use that link, it: Briefly opens the tab correctly; The tab closes; The original tab (where I clicked the link) redirects...
Read more >How To Fix Google Chrome Redirects - YouTube
How To Fix Google Chrome Redirects - Remove Chrome Redirect Virus · https://youtu.be/pRdbLEbuhrQ How to Change the Default Search in Google ...
Read more >Bug: Open this link in a new window - Progress Community
'Open this link in a new window' redirect page feature does not work as expected, it open in a browser tab instead of...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yes, you won’t get another route attempt because you gave it away to the network stack and network stack handles the redirects. But you can still traverse the redirect chain:
Thanks, I tried exacly this before reporting this “issue” above, but it didn’t work in my case. Seems like network interception is not always reliable when it comes to redirects.
When there are multiple redirects it’s not catching all of the requests, example (code https://github.com/boogie77/playwright-redirect-detection/blob/multiple_redirections/server/src/app.js#L18): Redirect chain:
/
button click/foo
/secondJump
/thirdJump
/bar
What we get from network log:
In my production app tests I actually don’t even get the initial url
context.route
, meaning I don’t even see/foo
(chrome extension opening new tab).Redirects in devtools:
@pavelfeldman Is this expected?
PS. Something weird I noticed is that when I enable
devtools
, the same network log fromcontext.route
is actually changed, it outputs only: