gecko-dev/remote/test/puppeteer-demo.js
Victor Porof 991b3c93c6 Bug 1561435 - Format remote/, a=automatic-formatting
# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D35925

--HG--
extra : source : b793788d0f38244b33eb59ea36e2c6624dbd12c5
2019-07-05 10:56:48 +02:00

27 lines
669 B
JavaScript

/**
* To run the server:
* $ ./mach run --remote-debugging-port=9000 --headless
* (this requires `ac_add_options --enable-cdp` to be set in your mozconfig)
*
* To run the test script:
* $ npm install puppeteer
* $ DEBUG="puppeteer:protocol" node puppeteer-demo.js
*/
/* global require */
const puppeteer = require("puppeteer");
console.log("Calling puppeteer.connect");
puppeteer
.connect({ browserURL: "http://localhost:9000" })
.then(async browser => {
console.log("Connect success!");
const page = await browser.newPage();
console.log("page", !!page);
await page.goto("https://www.mozilla.org/");
return browser.close();
});