mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
This commit updates all the non-Puppeteer unit tests to run using Mocha and then deletes the custom test runner framework from this repository. The documentation has also been updated.
Bundling For Web Browsers
To bundle Puppeteer using Browserify:
- Clone Puppeteer repository:
git clone https://github.com/puppeteer/puppeteer && cd puppeteer npm install- Run
npm run bundle
This will create ./utils/browser/puppeteer-web.js file that contains Puppeteer bundle.
You can use it later on in your web page to drive another browser instance through its WS Endpoint:
<script src='./puppeteer-web.js'></script>
<script>
const puppeteer = require('puppeteer');
const browser = await puppeteer.connect({
browserWSEndpoint: '<another-browser-ws-endpont>'
});
// ... drive automation ...
</script>
See our puppeteer-web tests for details.
Running inside Chrome Extension
You might want to enable unsafe-eval inside the extension by adding the following
to your manifest.json file:
"content_security_policy": "script-src 'self' 'unsafe-eval'; object-src 'self'"
Please see discussion in https://github.com/puppeteer/puppeteer/issues/3455.