Rayrun
← Back to Discord Forum

How to send command with SessionId from 'Target.attachedToTarget'

I'm using chromium

const browser = await chromium.launch({
// ...
  })
  const cdp = await browser.newBrowserCDPSession()
  await cdp.send('Target.setAutoAttach', {
    waitForDebuggerOnStart: true,
    autoAttach: true,
    flatten: true,
  })

  cdp.on('Target.attachedToTarget', async function({ sessionId, targetInfo, waitingForDebugger }) {
  const session = sessions.get(sessionId) // I want to do sth like 
  session.send(method, params) // <~~ I need to do it but dont know how to resolve session from sessionId
})

This thread is trying to answer question "How can I send a command with SessionId from 'Target.attachedToTarget' in Chromium?"

0 replies

Related Discord Threads

TwitterGitHubLinkedIn
AboutQuestionsDiscord ForumBrowser ExtensionTagsQA Jobs

Rayrun is a community for QA engineers. I am constantly looking for new ways to add value to people learning Playwright and other browser automation frameworks. If you have feedback, email [email protected].