@@ -3508,6 +3508,24 @@ export interface Page {
35083508 timeout?: number;
35093509 }): Promise<string>;
35103510
3511+ /**
3512+ * Returns the [Inspector](https://playwright.dev/docs/api/class-inspector) object associated with this page.
3513+ *
3514+ * **Usage**
3515+ *
3516+ * ```js
3517+ * const inspector = page.inspector();
3518+ * inspector.on('screencastFrame', data => {
3519+ * console.log('received frame, jpeg size:', data.length);
3520+ * });
3521+ * await inspector.startScreencast();
3522+ * // ... perform actions ...
3523+ * await inspector.stopScreencast();
3524+ * ```
3525+ *
3526+ */
3527+ inspector(): Inspector;
3528+
35113529 /**
35123530 * **NOTE** Use locator-based [locator.isChecked([options])](https://playwright.dev/docs/api/class-locator#locator-is-checked)
35133531 * instead. Read more about [locators](https://playwright.dev/docs/locators).
@@ -20418,6 +20436,237 @@ export interface FrameLocator {
2041820436 owner(): Locator;
2041920437}
2042020438
20439+ /**
20440+ * Interface to the Playwright inspector.
20441+ *
20442+ * **Usage**
20443+ *
20444+ * ```js
20445+ * const inspector = page.inspector();
20446+ * inspector.on('screencastframe', ({ data, width, height }) => {
20447+ * console.log(`received frame ${width}x${height}, jpeg size: ${data.length}`);
20448+ * });
20449+ * await inspector.startScreencast();
20450+ * // ... perform actions ...
20451+ * await inspector.stopScreencast();
20452+ * ```
20453+ *
20454+ */
20455+ export interface Inspector {
20456+ /**
20457+ * Emitted for each captured JPEG screencast frame while the screencast is running.
20458+ *
20459+ * **Usage**
20460+ *
20461+ * ```js
20462+ * const inspector = page.inspector();
20463+ * inspector.on('screencastframe', ({ data, width, height }) => {
20464+ * console.log(`frame ${width}x${height}, jpeg size: ${data.length}`);
20465+ * require('fs').writeFileSync('frame.jpg', data);
20466+ * });
20467+ * await inspector.startScreencast({ size: { width: 1280, height: 720 } });
20468+ * // ... perform actions ...
20469+ * await inspector.stopScreencast();
20470+ * ```
20471+ *
20472+ */
20473+ on(event: 'screencastframe', listener: (data: {
20474+ /**
20475+ * JPEG-encoded frame data.
20476+ */
20477+ data: Buffer;
20478+
20479+ /**
20480+ * Frame width in pixels.
20481+ */
20482+ width: number;
20483+
20484+ /**
20485+ * Frame height in pixels.
20486+ */
20487+ height: number;
20488+ }) => any): this;
20489+
20490+ /**
20491+ * Adds an event listener that will be automatically removed after it is triggered once. See `addListener` for more information about this event.
20492+ */
20493+ once(event: 'screencastframe', listener: (data: {
20494+ /**
20495+ * JPEG-encoded frame data.
20496+ */
20497+ data: Buffer;
20498+
20499+ /**
20500+ * Frame width in pixels.
20501+ */
20502+ width: number;
20503+
20504+ /**
20505+ * Frame height in pixels.
20506+ */
20507+ height: number;
20508+ }) => any): this;
20509+
20510+ /**
20511+ * Emitted for each captured JPEG screencast frame while the screencast is running.
20512+ *
20513+ * **Usage**
20514+ *
20515+ * ```js
20516+ * const inspector = page.inspector();
20517+ * inspector.on('screencastframe', ({ data, width, height }) => {
20518+ * console.log(`frame ${width}x${height}, jpeg size: ${data.length}`);
20519+ * require('fs').writeFileSync('frame.jpg', data);
20520+ * });
20521+ * await inspector.startScreencast({ size: { width: 1280, height: 720 } });
20522+ * // ... perform actions ...
20523+ * await inspector.stopScreencast();
20524+ * ```
20525+ *
20526+ */
20527+ addListener(event: 'screencastframe', listener: (data: {
20528+ /**
20529+ * JPEG-encoded frame data.
20530+ */
20531+ data: Buffer;
20532+
20533+ /**
20534+ * Frame width in pixels.
20535+ */
20536+ width: number;
20537+
20538+ /**
20539+ * Frame height in pixels.
20540+ */
20541+ height: number;
20542+ }) => any): this;
20543+
20544+ /**
20545+ * Removes an event listener added by `on` or `addListener`.
20546+ */
20547+ removeListener(event: 'screencastframe', listener: (data: {
20548+ /**
20549+ * JPEG-encoded frame data.
20550+ */
20551+ data: Buffer;
20552+
20553+ /**
20554+ * Frame width in pixels.
20555+ */
20556+ width: number;
20557+
20558+ /**
20559+ * Frame height in pixels.
20560+ */
20561+ height: number;
20562+ }) => any): this;
20563+
20564+ /**
20565+ * Removes an event listener added by `on` or `addListener`.
20566+ */
20567+ off(event: 'screencastframe', listener: (data: {
20568+ /**
20569+ * JPEG-encoded frame data.
20570+ */
20571+ data: Buffer;
20572+
20573+ /**
20574+ * Frame width in pixels.
20575+ */
20576+ width: number;
20577+
20578+ /**
20579+ * Frame height in pixels.
20580+ */
20581+ height: number;
20582+ }) => any): this;
20583+
20584+ /**
20585+ * Emitted for each captured JPEG screencast frame while the screencast is running.
20586+ *
20587+ * **Usage**
20588+ *
20589+ * ```js
20590+ * const inspector = page.inspector();
20591+ * inspector.on('screencastframe', ({ data, width, height }) => {
20592+ * console.log(`frame ${width}x${height}, jpeg size: ${data.length}`);
20593+ * require('fs').writeFileSync('frame.jpg', data);
20594+ * });
20595+ * await inspector.startScreencast({ size: { width: 1280, height: 720 } });
20596+ * // ... perform actions ...
20597+ * await inspector.stopScreencast();
20598+ * ```
20599+ *
20600+ */
20601+ prependListener(event: 'screencastframe', listener: (data: {
20602+ /**
20603+ * JPEG-encoded frame data.
20604+ */
20605+ data: Buffer;
20606+
20607+ /**
20608+ * Frame width in pixels.
20609+ */
20610+ width: number;
20611+
20612+ /**
20613+ * Frame height in pixels.
20614+ */
20615+ height: number;
20616+ }) => any): this;
20617+
20618+ /**
20619+ * Starts capturing screencast frames. Frames are emitted as
20620+ * [inspector.on('screencastframe')](https://playwright.dev/docs/api/class-inspector#inspector-event-screencast-frame)
20621+ * events.
20622+ *
20623+ * **Usage**
20624+ *
20625+ * ```js
20626+ * const inspector = page.inspector();
20627+ * inspector.on('screencastframe', ({ data, width, height }) => {
20628+ * console.log(`frame ${width}x${height}, size: ${data.length}`);
20629+ * });
20630+ * await inspector.startScreencast({ size: { width: 800, height: 600 } });
20631+ * // ... perform actions ...
20632+ * await inspector.stopScreencast();
20633+ * ```
20634+ *
20635+ * @param options
20636+ */
20637+ startScreencast(options?: {
20638+ /**
20639+ * Optional dimensions for the screencast frames. If not specified, the current page viewport size is used.
20640+ */
20641+ size?: {
20642+ /**
20643+ * Frame width in pixels.
20644+ */
20645+ width: number;
20646+
20647+ /**
20648+ * Frame height in pixels.
20649+ */
20650+ height: number;
20651+ };
20652+ }): Promise<void>;
20653+
20654+ /**
20655+ * Stops the screencast started with
20656+ * [inspector.startScreencast([options])](https://playwright.dev/docs/api/class-inspector#inspector-start-screencast).
20657+ *
20658+ * **Usage**
20659+ *
20660+ * ```js
20661+ * await inspector.startScreencast();
20662+ * // ... perform actions ...
20663+ * await inspector.stopScreencast();
20664+ * ```
20665+ *
20666+ */
20667+ stopScreencast(): Promise<void>;
20668+ }
20669+
2042120670/**
2042220671 * Keyboard provides an api for managing a virtual keyboard. The high level api is
2042320672 * [keyboard.type(text[, options])](https://playwright.dev/docs/api/class-keyboard#keyboard-type), which takes raw
0 commit comments