···453453 */
454454 screenshot: (options?: ScreenshotOptions) => Promise<string>
455455}
456456+457457+export const cdp: () => CDPSession
456458```
457459458460## Interactivity API
···840842 await removeFile(file)
841843})
842844```
845845+846846+## CDP Session
847847+848848+Vitest exposes access to raw Chrome Devtools Protocol via the `cdp` method exported from `@vitest/browser/context`. It is mostly useful to library authors to build tools on top of it.
849849+850850+```ts
851851+import { cdp } from '@vitest/browser/context'
852852+853853+const input = document.createElement('input')
854854+document.body.appendChild(input)
855855+input.focus()
856856+857857+await cdp().send('Input.dispatchKeyEvent', {
858858+ type: 'keyDown',
859859+ text: 'a',
860860+})
861861+862862+expect(input).toHaveValue('a')
863863+```
864864+865865+::: warning
866866+CDP session works only with `playwright` provider and only when using `chromium` browser. You can read more about it in playwright's [`CDPSession`](https://playwright.dev/docs/api/class-cdpsession) documentation.
867867+:::
843868844869## Custom Commands
845870
+5
packages/browser/context.d.ts
···1919 flag?: string | number
2020}
21212222+export interface CDPSession {
2323+ // methods are defined by the provider type augmentation
2424+}
2525+2226export interface ScreenshotOptions {
2327 element?: Element
2428 /**
···242246}
243247244248export const page: BrowserPage
249249+export const cdp: () => CDPSession