We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I'm having issues reading the data from a ws connection already made by the page.
I've tried the add_handler with the cdp websocket triggers, but with no succes.
Can someone please give me an example of how to intercept ws connections?
[]s
The text was updated successfully, but these errors were encountered:
got it
In case anyone needs:
import nodriver as uc from nodriver import cdp import asyncio
async def main(): browser = await uc.start( headless=False, browser_args=[ "--ignore-certificate-errors", ], ) tab = await browser.get("http://localhost:8083")
# Habilita o domínio Network await tab.send(cdp.network.enable()) # Manipulador para mensagens WebSocket recebidas tab.add_handler( cdp.network.WebSocketFrameReceived, lambda event: print(f"Mensagem recebida: {event.response.payload_data}"), ) # Manipulador para mensagens WebSocket enviadas tab.add_handler( cdp.network.WebSocketFrameSent, lambda event: print(f"Mensagem enviada: {event.response.payload_data}"), ) # Manipulador para criação de conexões WebSocket tab.add_handler( cdp.network.WebSocketCreated, lambda event: print(f"WebSocket criado: {event.url}"), ) # Manipulador para fechamento de conexões WebSocket tab.add_handler( cdp.network.WebSocketClosed, lambda event: print(f"WebSocket fechado: {event.timestamp}"), ) # Mantém o programa em execução para capturar os eventos while True: await asyncio.sleep(1)
if name == "main": asyncio.run(main())
Sorry, something went wrong.
No branches or pull requests
I'm having issues reading the data from a ws connection already made by the page.
I've tried the add_handler with the cdp websocket triggers, but with no succes.
Can someone please give me an example of how to intercept ws connections?
[]s
The text was updated successfully, but these errors were encountered: