Skip to main content
Version: 3.3

abstractBrowserController <Library, LibraryOptions, LaunchResult, NewPageOptions, NewPageResult>

The BrowserController serves two purposes. First, it is the base class that specialized controllers like PuppeteerController or PlaywrightController extend. Second, it defines the public interface of the specialized classes which provide only private methods. Therefore, we do not keep documentation for the specialized classes, because it's the same for all of them.

@hideconstructor

Hierarchy

Index

Constructors

constructor

  • new BrowserController<Library, LibraryOptions, LaunchResult, NewPageOptions, NewPageResult>(browserPlugin: BrowserPlugin<Library, LibraryOptions, LaunchResult, NewPageOptions, NewPageResult>): BrowserController<Library, LibraryOptions, LaunchResult, NewPageOptions, NewPageResult>
  • Type parameters

    • Library: CommonLibrary = CommonLibrary
    • LibraryOptions: undefined | Dictionary<any> = Parameters<Library[launch]>[0]
    • LaunchResult: CommonBrowser = UnwrapPromise<ReturnType<Library[launch]>>
    • NewPageOptions = Parameters<LaunchResult[newPage]>[0]
    • NewPageResult = UnwrapPromise<ReturnType<LaunchResult[newPage]>>

    Parameters

    • browserPlugin: BrowserPlugin<Library, LibraryOptions, LaunchResult, NewPageOptions, NewPageResult>

    Returns BrowserController<Library, LibraryOptions, LaunchResult, NewPageOptions, NewPageResult>

Properties

activePages

activePages: number = 0

browser

browser: LaunchResult = ...

Browser representation of the underlying automation library.

browserPlugin

browserPlugin: BrowserPlugin<Library, LibraryOptions, LaunchResult, NewPageOptions, NewPageResult>

The BrowserPlugin instance used to launch the browser.

id

id: string = ...

isActive

isActive: boolean = false

lastPageOpenedAt

lastPageOpenedAt: number = ...

launchContext

launchContext: LaunchContext<Library, LibraryOptions, LaunchResult, NewPageOptions, NewPageResult> = ...

The configuration the browser was launched with.

totalPages

totalPages: number = 0

staticexternaldefaultMaxListeners

defaultMaxListeners: number

Methods

externaladdListener

  • addListener<U>(event: U, listener: BrowserControllerEvents<Library, LibraryOptions, LaunchResult, NewPageOptions, NewPageResult>[U]): BrowserController<Library, LibraryOptions, LaunchResult, NewPageOptions, NewPageResult>
  • Type parameters

    • U: BROWSER_CLOSED

    Parameters

    • externalevent: U
    • externallistener: BrowserControllerEvents<Library, LibraryOptions, LaunchResult, NewPageOptions, NewPageResult>[U]

    Returns BrowserController<Library, LibraryOptions, LaunchResult, NewPageOptions, NewPageResult>

close

  • close(): Promise<void>
  • Gracefully closes the browser and makes sure there will be no lingering browser processes.

    Emits 'browserClosed' event.


    Returns Promise<void>

externalemit

  • emit<U>(event: U, ...args: Parameters<BrowserControllerEvents<Library, LibraryOptions, LaunchResult, NewPageOptions, NewPageResult>[U]>): boolean
  • Type parameters

    • U: BROWSER_CLOSED

    Parameters

    • externalevent: U
    • externalrest...args: Parameters<BrowserControllerEvents<Library, LibraryOptions, LaunchResult, NewPageOptions, NewPageResult>[U]>

    Returns boolean

externaleventNames

  • eventNames<U>(): U[]
  • Type parameters

    • U: BROWSER_CLOSED

    Returns U[]

getCookies

  • getCookies(page: NewPageResult): Promise<Cookie[]>
  • Parameters

    • page: NewPageResult

    Returns Promise<Cookie[]>

externalgetMaxListeners

  • getMaxListeners(): number
  • Returns number

kill

  • kill(): Promise<void>
  • Immediately kills the browser process.

    Emits 'browserClosed' event.


    Returns Promise<void>

externallistenerCount

  • listenerCount(type: BROWSER_CLOSED): number
  • Parameters

    • externaltype: BROWSER_CLOSED

    Returns number

externallisteners

  • listeners<U>(type: U): BrowserControllerEvents<Library, LibraryOptions, LaunchResult, NewPageOptions, NewPageResult>[U][]
  • Type parameters

    • U: BROWSER_CLOSED

    Parameters

    • externaltype: U

    Returns BrowserControllerEvents<Library, LibraryOptions, LaunchResult, NewPageOptions, NewPageResult>[U][]

externaloff

  • off<U>(event: U, listener: BrowserControllerEvents<Library, LibraryOptions, LaunchResult, NewPageOptions, NewPageResult>[U]): BrowserController<Library, LibraryOptions, LaunchResult, NewPageOptions, NewPageResult>
  • Type parameters

    • U: BROWSER_CLOSED

    Parameters

    • externalevent: U
    • externallistener: BrowserControllerEvents<Library, LibraryOptions, LaunchResult, NewPageOptions, NewPageResult>[U]

    Returns BrowserController<Library, LibraryOptions, LaunchResult, NewPageOptions, NewPageResult>

externalon

  • on<U>(event: U, listener: BrowserControllerEvents<Library, LibraryOptions, LaunchResult, NewPageOptions, NewPageResult>[U]): BrowserController<Library, LibraryOptions, LaunchResult, NewPageOptions, NewPageResult>
  • Type parameters

    • U: BROWSER_CLOSED

    Parameters

    • externalevent: U
    • externallistener: BrowserControllerEvents<Library, LibraryOptions, LaunchResult, NewPageOptions, NewPageResult>[U]

    Returns BrowserController<Library, LibraryOptions, LaunchResult, NewPageOptions, NewPageResult>

externalonce

  • once<U>(event: U, listener: BrowserControllerEvents<Library, LibraryOptions, LaunchResult, NewPageOptions, NewPageResult>[U]): BrowserController<Library, LibraryOptions, LaunchResult, NewPageOptions, NewPageResult>
  • Type parameters

    • U: BROWSER_CLOSED

    Parameters

    • externalevent: U
    • externallistener: BrowserControllerEvents<Library, LibraryOptions, LaunchResult, NewPageOptions, NewPageResult>[U]

    Returns BrowserController<Library, LibraryOptions, LaunchResult, NewPageOptions, NewPageResult>

externalprependListener

  • prependListener<U>(event: U, listener: BrowserControllerEvents<Library, LibraryOptions, LaunchResult, NewPageOptions, NewPageResult>[U]): BrowserController<Library, LibraryOptions, LaunchResult, NewPageOptions, NewPageResult>
  • Type parameters

    • U: BROWSER_CLOSED

    Parameters

    • externalevent: U
    • externallistener: BrowserControllerEvents<Library, LibraryOptions, LaunchResult, NewPageOptions, NewPageResult>[U]

    Returns BrowserController<Library, LibraryOptions, LaunchResult, NewPageOptions, NewPageResult>

externalprependOnceListener

  • prependOnceListener<U>(event: U, listener: BrowserControllerEvents<Library, LibraryOptions, LaunchResult, NewPageOptions, NewPageResult>[U]): BrowserController<Library, LibraryOptions, LaunchResult, NewPageOptions, NewPageResult>
  • Type parameters

    • U: BROWSER_CLOSED

    Parameters

    • externalevent: U
    • externallistener: BrowserControllerEvents<Library, LibraryOptions, LaunchResult, NewPageOptions, NewPageResult>[U]

    Returns BrowserController<Library, LibraryOptions, LaunchResult, NewPageOptions, NewPageResult>

externalrawListeners

  • rawListeners<U>(type: U): BrowserControllerEvents<Library, LibraryOptions, LaunchResult, NewPageOptions, NewPageResult>[U][]
  • Type parameters

    • U: BROWSER_CLOSED

    Parameters

    • externaltype: U

    Returns BrowserControllerEvents<Library, LibraryOptions, LaunchResult, NewPageOptions, NewPageResult>[U][]

externalremoveAllListeners

  • removeAllListeners(event?: BROWSER_CLOSED): BrowserController<Library, LibraryOptions, LaunchResult, NewPageOptions, NewPageResult>
  • Parameters

    • externaloptionalevent: BROWSER_CLOSED

    Returns BrowserController<Library, LibraryOptions, LaunchResult, NewPageOptions, NewPageResult>

externalremoveListener

  • removeListener<U>(event: U, listener: BrowserControllerEvents<Library, LibraryOptions, LaunchResult, NewPageOptions, NewPageResult>[U]): BrowserController<Library, LibraryOptions, LaunchResult, NewPageOptions, NewPageResult>
  • Type parameters

    • U: BROWSER_CLOSED

    Parameters

    • externalevent: U
    • externallistener: BrowserControllerEvents<Library, LibraryOptions, LaunchResult, NewPageOptions, NewPageResult>[U]

    Returns BrowserController<Library, LibraryOptions, LaunchResult, NewPageOptions, NewPageResult>

setCookies

  • setCookies(page: NewPageResult, cookies: Cookie[]): Promise<void>
  • Parameters

    • page: NewPageResult
    • cookies: Cookie[]

    Returns Promise<void>

externalsetMaxListeners

  • setMaxListeners(n: number): BrowserController<Library, LibraryOptions, LaunchResult, NewPageOptions, NewPageResult>
  • Parameters

    • externaln: number

    Returns BrowserController<Library, LibraryOptions, LaunchResult, NewPageOptions, NewPageResult>