BrowserInstance.d.ts 1.0 KB

123456789101112131415161718192021222324
  1. import { type Process } from '@puppeteer/browsers';
  2. import type { MapperOptions } from '../bidiMapper/BidiServer.js';
  3. import { MapperServerCdpConnection } from './MapperCdpConnection.js';
  4. import type { SimpleTransport } from './SimpleTransport.js';
  5. export type ChromeOptions = {
  6. chromeArgs: string[];
  7. chromeBinary?: string;
  8. };
  9. /**
  10. * BrowserProcess is responsible for running the browser and BiDi Mapper within
  11. * it.
  12. * 1. Launch Chromium (using Puppeteer for now).
  13. * 2. Get `BiDi-CDP` mapper JS binaries using `MapperReader`.
  14. * 3. Run `BiDi-CDP` mapper in launched browser using `MapperRunner`.
  15. * 4. Bind `BiDi-CDP` mapper to the `BiDi server` to forward messages from BiDi
  16. * Mapper to the client.
  17. */
  18. export declare class BrowserInstance {
  19. #private;
  20. static run(chromeOptions: ChromeOptions, mapperOptions: MapperOptions, verbose: boolean): Promise<BrowserInstance>;
  21. constructor(mapperCdpConnection: MapperServerCdpConnection, browserProcess: Process);
  22. close(): Promise<void>;
  23. bidiSession(): SimpleTransport;
  24. }