Skip to content

Commit

Permalink
Add support to use WSEndpoint on puppeter (#1350)
Browse files Browse the repository at this point in the history
  • Loading branch information
Gabriel Caires authored and DavertMik committed Dec 19, 2018
1 parent d7ccfd3 commit 15c7595
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/helper/Puppeteer.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ const consoleLogStore = new Console();
*
* ```js
* "chrome": {
* "executablePath" : "/path/to/Chrome"
* "executablePath" : "/path/to/Chrome",
* "browserWSEndpoint": "ws://localhost:3000"
* }
* ```
*
Expand Down Expand Up @@ -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());
Expand Down

0 comments on commit 15c7595

Please sign in to comment.