mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
feat: add slowMo option to puppeteer.connect (#1864)
This patch introduces a `slowMo` option to the `puppeteer.connect` method. The option is similar to the one in `puppeteer.launch` and is used to slow down the connection.
This commit is contained in:
parent
797b561013
commit
b61e67d001
@ -260,6 +260,7 @@ puppeteer.launch().then(async browser => {
|
||||
- `options` <[Object]>
|
||||
- `browserWSEndpoint` <[string]> a [browser websocket endpoint](#browserwsendpoint) to connect to.
|
||||
- `ignoreHTTPSErrors` <[boolean]> Whether to ignore HTTPS errors during navigation. Defaults to `false`.
|
||||
- `slowMo` <[number]> Slows down Puppeteer operations by the specified amount of milliseconds. Useful so that you can see what is going on.
|
||||
- returns: <[Promise]<[Browser]>>
|
||||
|
||||
This methods attaches Puppeteer to an existing Chromium instance.
|
||||
|
@ -196,7 +196,8 @@ class Launcher {
|
||||
* @return {!Promise<!Browser>}
|
||||
*/
|
||||
static async connect(options = {}) {
|
||||
const connection = await Connection.create(options.browserWSEndpoint);
|
||||
const connectionDelay = options.slowMo || 0;
|
||||
const connection = await Connection.create(options.browserWSEndpoint, connectionDelay);
|
||||
return Browser.create(connection, options, null, () => connection.send('Browser.close'));
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user