-
Notifications
You must be signed in to change notification settings - Fork 289
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Puppeteer v22 compatibility #576
Conversation
This PR includes |
Hello @colinrotherham, thank you for this PR. Tests are failing, could you try to fix them please? |
@gregberge It's caused when upgrading the current Same release that rolled to Chrome 121.0.6167.85 Any suggestions? |
Enabling Might need to to update these tests to use TargetCloseError: Protocol error (Runtime.releaseObject): Target closed
at CallbackRegistry.clear (/jest-puppeteer/node_modules/puppeteer-core/src/common/CallbackRegistry.ts:93:30)
at CdpCDPSession._onClosed (/jest-puppeteer/node_modules/puppeteer-core/src/cdp/CDPSession.ts:149:21)
at Connection.onMessage (/jest-puppeteer/node_modules/puppeteer-core/src/cdp/Connection.ts:167:17)
at WebSocket.<anonymous> (/jest-puppeteer/node_modules/puppeteer-core/src/node/NodeWebSocketTransport.ts:45:24)
at callListener (/jest-puppeteer/node_modules/ws/lib/event-target.js:290:14)
at WebSocket.onMessage (/jest-puppeteer/node_modules/ws/lib/event-target.js:209:9)
at WebSocket.emit (node:events:514:28)
at Receiver.receiverOnMessage (/jest-puppeteer/node_modules/ws/lib/websocket.js:1209:20)
at Receiver.emit (node:events:514:28)
at /jest-puppeteer/node_modules/ws/lib/receiver.js:608:16
at node:internal/process/task_queues:140:7
at AsyncResource.runInAsyncScope (node:async_hooks:206:9)
at AsyncResource.runMicrotask (node:internal/process/task_queues:137:8)
at processTicksAndRejections (node:internal/process/task_queues:95:5) {
cause: ProtocolError:
at Callback.<instance_members_initializer> (/jest-puppeteer/node_modules/puppeteer-core/src/common/CallbackRegistry.ts:104:12)
at new Callback (/jest-puppeteer/node_modules/puppeteer-core/src/common/CallbackRegistry.ts:109:3)
at CallbackRegistry.create (/jest-puppeteer/node_modules/puppeteer-core/src/common/CallbackRegistry.ts:27:22)
at Connection._rawSend (/jest-puppeteer/node_modules/puppeteer-core/src/cdp/Connection.ts:120:22)
at CdpCDPSession.send (/jest-puppeteer/node_modules/puppeteer-core/src/cdp/CDPSession.ts:95:29)
at releaseObject (/jest-puppeteer/node_modules/puppeteer-core/src/cdp/JSHandle.ts:103:6)
at CdpJSHandle.dispose (/jest-puppeteer/node_modules/puppeteer-core/src/cdp/JSHandle.ts:72:11)
at WaitTask.terminate (/jest-puppeteer/node_modules/puppeteer-core/src/common/WaitTask.ts:191:30)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
}
]
2024-02-09T16:35:54.720Z puppeteer:protocol:RECV ◀ [
'{"method":"Target.targetInfoChanged","params":{"targetInfo":{"targetId":"81AA279BA32A8FCE5C68347D7A513A5F","type":"page","title":"Test App","url":"http://localhost:4444/shadow.html","attached":false,"canAccessOpener":false,"browserContextId":"5583E26A9740FC1E24E60C3D4EB678BB"}}}'
]
2024-02-09T16:35:54.720Z puppeteer:protocol:RECV ◀ [
'{"method":"Target.targetDestroyed","params":{"targetId":"81AA279BA32A8FCE5C68347D7A513A5F"}}'
]
2024-02-09T16:35:54.720Z puppeteer:protocol:RECV ◀ [
'{"method":"Target.targetInfoChanged","params":{"targetInfo":{"targetId":"FD04A3633B0930ED767EC22E01F2D5D2","type":"tab","title":"","url":"","attached":false,"canAccessOpener":false,"browserContextId":"5583E26A9740FC1E24E60C3D4EB678BB"}}}'
]
2024-02-09T16:35:54.720Z puppeteer:protocol:RECV ◀ [
'{"method":"Target.detachedFromTarget","params":{"sessionId":"4019DE6ED77DBBE81A4330BD94EF6CBB","targetId":"FD04A3633B0930ED767EC22E01F2D5D2"}}'
]
2024-02-09T16:35:54.720Z puppeteer:protocol:RECV ◀ [
'{"method":"Target.targetDestroyed","params":{"targetId":"FD04A3633B0930ED767EC22E01F2D5D2"}}'
]
2024-02-09T16:35:54.720Z puppeteer:protocol:RECV ◀ [
'{"id":29,"error":{"code":-32001,"message":"Session with given id not found."}}'
]
2024-02-09T16:35:54.721Z puppeteer:protocol:RECV ◀ [
'{"id":30,"error":{"code":-32001,"message":"Session with given id not found."}}'
] |
Ah I hadn't noticed the Declarative Shadow DOM
Looks like a quick fix, trying now |
1e9252d
to
83767c5
Compare
Updating to Puppeteer v22 ends Node.js v16 support
Fixes failing Shadow DOM tests since the previous `shadowroot` attribute was deprecated in Chrome 112 and removed in 119
83767c5
to
12a66c2
Compare
Ready for review again @gregberge These changes are still |
Summary
From the
puppeteer@22
release we have two main breaking changes + docs:headless: 'new'
is nowheadless: true
browser.createIncognitoBrowserContext()
browser.createBrowserContext()
Test plan
I've added feature detection for
"createBrowserContext" in browser
to maintain support for Puppeteer <= v21