Skip to content

Expose CDP in the browser mode #5812

@sheremet-va

Description

@sheremet-va

Clear and concise description of the problem

It is very useful to have access to the CDP instance from the browser for library authors to build APIs on top of (see: https://github.com/dmtrKovalenko/cypress-real-events)

Suggested solution

Expose cdp method from @vitest/browser/context that returns an object with three methods:

import { cdp } from '@vitest/browser/context'

await cdp.send('Input.dispatchMouseEvent')

cdp.on('Network.requestWillBeSent', doSomething)
cdp.once('Network.requestWillBeSent', doSomethingOnce)

Alternative

No response

Additional context

No response

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    feat: browserIssues and PRs related to the browser runnerp2-nice-to-haveNot breaking anything but nice to have (priority)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions