-
Notifications
You must be signed in to change notification settings - Fork 32
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
CDP server issues on MacOS (m2) #339
Comments
Hello @addy999 Can you retry with |
Here is what I reproduce with the following gist https://gist.github.com/krichprollsch/f510c3c89a21dd70e406a9c79f3b3b06 $ docker run --rm -ti --privileged lpd:issue339
//issue339.py:8: DeprecationWarning: There is no current event loop
asyncio.get_event_loop().run_until_complete(main())
Traceback (most recent call last):
File "//issue339.py", line 8, in <module>
asyncio.get_event_loop().run_until_complete(main())
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^
File "/usr/local/lib/python3.13/asyncio/base_events.py", line 720, in run_until_complete
return future.result()
~~~~~~~~~~~~~^^
File "//issue339.py", line 6, in main
page = await b.newPage()
^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.13/site-packages/pyppeteer/browser.py", line 202, in newPage
return await self._defaultContext.newPage()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.13/site-packages/pyppeteer/browser.py", line 358, in newPage
return await self._browser._createPageInContext(self._id)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.13/site-packages/pyppeteer/browser.py", line 213, in _createPageInContext
raise BrowserError('Failed to create target for page.')
pyppeteer.errors.BrowserError: Failed to create target for page.
debug(cli): Server opts: listening internally on /tmp/lightpanda...
info(websocket): starting blocking worker to listen on 127.0.0.1:9222
info(server): accepting new conn...
debug(websocket): (127.0.0.1:43946) connected
debug(websocket): (127.0.0.1:43952) connected
debug(handler): connected to Stream server
info(server): client connected
debug(websocket): (127.0.0.1:43952) connection successfully upgraded
debug(websocket): (127.0.0.1:43952) received text message
debug(cdp): Req > id 1, method target.getBrowserContexts
debug(cdp): Res > id 1, sessionID null, result cdp.target.getBrowserContexts.Resp{ .browserContextIds = { } }
debug(websocket): (127.0.0.1:43952) received text message
debug(cdp): Req > id 2, method target.setDiscoverTargets
debug(cdp): Res > id 2, sessionID null, result null
debug(websocket): (127.0.0.1:43952) received text message
debug(cdp): Req > id 3, method target.createTarget
debug(cdp): Event > method Target.attachedToTarget, sessionID null
debug(cdp): Res > id 3, sessionID null, result cdp.target.createTarget { .targetId = 57356548460A8F29706A2ADF14316298 }
debug(websocket): (127.0.0.1:43952) connection closed: error.Closed
info(server): close cmd, closing conn...
debug(server): connection closed
info(server): accepting new conn...
debug(server): read has been canceled |
Okay I did it with debug(handler): connected to Stream server
info(server): client connected
debug(websocket): (127.0.0.1:61253) connection successfully upgraded
debug(websocket): (127.0.0.1:61253) received text message
debug(cdp): Req > id 1, method target.getBrowserContexts
debug(cdp): Res > id 1, sessionID null, result cdp.target.getBrowserContexts.Resp{ .browserContextIds = { } }
debug(websocket): (127.0.0.1:61253) received text message
debug(cdp): Req > id 2, method target.setDiscoverTargets
debug(cdp): Res > id 2, sessionID null, result null
debug(websocket): (127.0.0.1:61253) received text message
debug(cdp): Req > id 3, method target.createTarget
debug(cdp): Event > method Target.attachedToTarget, sessionID null
debug(cdp): Res > id 3, sessionID null, result cdp.target.createTarget { .targetId = 57356548460A8F29706A2ADF14316298 } Now I'm seeing a TegetError ----> 1 page = await b.newPage()
File ~/.pyenv/versions/3.10.10/lib/python3.10/site-packages/pyppeteer/browser.py:202, in Browser.newPage(self)
200 async def newPage(self) -> Page:
201 """Make new page on this browser and return its object."""
--> 202 return await self._defaultContext.newPage()
File ~/.pyenv/versions/3.10.10/lib/python3.10/site-packages/pyppeteer/browser.py:358, in BrowserContext.newPage(self)
356 async def newPage(self) -> Page:
357 """Create a new page in the browser context."""
--> 358 return await self._browser._createPageInContext(self._id)
File ~/.pyenv/versions/3.10.10/lib/python3.10/site-packages/pyppeteer/browser.py:213, in Browser._createPageInContext(self, contextId)
211 target = self._targets.get(targetId)
212 if target is None:
--> 213 raise BrowserError('Failed to create target for page.')
214 if not await target._initializedPromise:
215 raise BrowserError('Failed to create target for page.')
BrowserError: Failed to create target for page. |
ok thank you, I think I have what I need to start debugging. |
Hi, any progress on this? |
Not really. I tried using the code from #285 which is an effort to bring a better chromedp compatibility, but the result is the same. |
I enabled the log level to debug with: import logging
logging.basicConfig()
logging.getLogger().setLevel(logging.DEBUG) https://gist.github.com/krichprollsch/554c553a0d17bfe4473d291132b72a23#file-log-python-lpd vs chrome https://gist.github.com/krichprollsch/554c553a0d17bfe4473d291132b72a23#file-log-python-chrome |
ok the event
|
The next issue was the support of the deprecated |
Last change #353 implement |
@addy999 My own basic test works as expected now. I forced a new nightly build. |
Running the nightly build and connecting via puppeteer from another terminal:
Terminal 1
Terminal 2:
The text was updated successfully, but these errors were encountered: