RemoteBrowserPool <Page>
Implements
- IBrowserPool<Page>
Index
Constructors
Properties
Accessors
Methods
Constructors
constructor
Parameters
options: RemoteBrowserPoolOptions
Returns RemoteBrowserPool<Page>
Properties
readonlybrowserPool
The wrapped pool that performs the remote connections and serves pages.
Accessors
maxOpenBrowsers
Maximum number of remote browsers that may be open at the same time.
Returns number
Parameters
value: number
Returns void
Methods
[asyncDispose]
Returns Promise<void>
closePage
Signals the pool that the caller is done with the page. The pool is responsible for closing the page and performing any necessary cleanup (e.g. retiring the underlying browser when a session has gone bad).
Parameters
page: Page
The page to release back to the pool.
optionaloptions: { error?: Error }
optionalerror: Error
If the page is being released because of an error, pass the error here. In particular, if the error is a SessionError, implementations should treat it as a signal to purge all state associated with the session (e.g. discard any browser that served the page).
Returns Promise<void>
destroy
Closes all browsers, releases any still-open remote sessions, and tears down the wrapped pool.
Returns Promise<void>
extractPageState
injectPageState
Injects state (currently just cookies) into a page. This is the counterpart to IBrowserPool.extractPageState and lets the caller set up a page — for example, seeding it with the crawling session's cookies before navigation.
As with IBrowserPool.newPage, the caller decides what state to inject, while the pool decides how.
Isolation between pages is best-effort: depending on the pool implementation and its configuration, multiple pages may share a browsing context, so injected state (such as cookies) can bleed across pages served by the same underlying browser.
Parameters
page: Page
The page to inject state into.
state: PageState
The state to inject.
Returns Promise<void>
newPage
Opens a new page, waiting first until maxOpenBrowsers allows it (either a new browser slot is free, or an active browser still has page capacity).
Parameters
optionaloptions: NewPageOptions
Returns Promise<Page>
An IBrowserPool implementation for remote browser services.
Unlike configuring a remote browser through a crawler's
launchContext, this pool is the single owner of all remote-session concerns:release()fires exactly once per session on close/crash/teardown (no leaks, no double-release);The wrapped BrowserPool and its plugin only perform the library-specific
connect()call.Pass an instance as the crawler's
browserPooloption: