From 84cb963b71ff3102032ea0d58d54c671c314cdb4 Mon Sep 17 00:00:00 2001 From: Gabriel Caires Date: Thu, 22 Nov 2018 16:09:08 -0300 Subject: [PATCH] Add support to use WSEndpoint on puppeter --- lib/helper/Puppeteer.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/helper/Puppeteer.js b/lib/helper/Puppeteer.js index 74f058d0f..834c7d7ce 100644 --- a/lib/helper/Puppeteer.js +++ b/lib/helper/Puppeteer.js @@ -59,7 +59,8 @@ const consoleLogStore = new Console(); * * ```js * "chrome": { - * "executablePath" : "/path/to/Chrome" + * "executablePath" : "/path/to/Chrome", + * "browserWSEndpoint": "ws://localhost:3000" * } * ``` * @@ -376,7 +377,7 @@ class Puppeteer extends Helper { } async _startBrowser() { - this.browser = await puppeteer.launch(this.puppeteerOptions); + this.browser = this.puppeteerOptions.browserWSEndpoint ? await puppeteer.connect(this.puppeteerOptions) : await puppeteer.launch(this.puppeteerOptions); this.browser.on('targetcreated', target => target.page().then(page => targetCreatedHandler.call(this, page))); this.browser.on('targetchanged', (target) => { this.debugSection('Url', target.url());