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
Add a request handler which calls request.continue() on the first request it sees but request.abort() on the second.
page.goto() a page which says <script>window.location = 'something'
puppeteer loads the first page, that request is allowed, it then tries to load the second page, that request is aborted, page.goto hangs forever and never returns.
Sample code to reproduce:
'use strict'constpuppeteer=require('puppeteer')asyncfunctiontest(){constbrowser=awaitpuppeteer.launch()constcontext=awaitbrowser.createIncognitoBrowserContext()constpage=awaitcontext.newPage()awaitpage.setRequestInterception(true)page.on('request',(request)=>{consturl=newURL(request.url())if(request.isInterceptResolutionHandled())returnif(request.isNavigationRequest()&&request.frame()===page.mainFrame()&&url.pathname==='/'){console.log(`aborting ${url}`)request.abort('aborted',0)}else{console.log(`allowing ${url.href}`)request.continue(request.continueRequestOverrides(),0)}})console.log('requesting page')// the following URL contains "<script>window.location='/'</script>"awaitpage.goto('https://unequivocal.eu/location.html')console.log('page loaded')awaitcontext.close()awaitbrowser.close()}test()
Puppeteer version
19.2.0
Node.js version
16.14.0
npm version
8.3.1
What operating system are you seeing the problem on?
Doing request.continue({ url: 'data,' }, 0) as an alternative method of 'aborting' the request also causes a hang. But request.continue({ method: 'HEAD' }, 0) doesn't hang.
Bug description
Steps to reproduce the problem:
page.setRequestInterception(true)
request
handler which callsrequest.continue()
on the first request it sees butrequest.abort()
on the second.page.goto()
a page which says<script>window.location = 'something'
page.goto
hangs forever and never returns.Sample code to reproduce:
Puppeteer version
19.2.0
Node.js version
16.14.0
npm version
8.3.1
What operating system are you seeing the problem on?
Linux, Windows
Configuration file
No response
Relevant log output
The text was updated successfully, but these errors were encountered: